views:

10

answers:

1

I have used a join query for retrieving value from two tables one is blogquestion and userdetails I wrote this query

$this->questions = Doctrine_Query::create()
  ->select('b.question_id,b.user_id,b.question_title,b.question_tags,b.created_at,u.id,u.name')
  ->from('BlogQuestion b')
  ->leftJoin('b.UserDetails u')
  ->execute(); 

In the template iam displaying the result using a foreach

<?php foreach($questions as $quest):?>

 echo $quest->getQuestionTitle() 
 echo $quest->getQuestionTags() 
 echo $quest->getName() 

<?php endforeach?>

title is getting from the blogquestion table and name is in usredetails table

iam getting the eerror

Unknown record property / related component "name" on "BlogQuestion"

+2  A: 

Use: $quest->getUserdetails()->getName() or $quest['UserDetails']['name'].

Crozin
Thanks Crozin $quest['UserDetails']['name'] is working fine
THOmas