I'm not sure if it's that I'm not doing correctly but this is giving me an 
error:

I have 2 Entities: Task and TaskUser. They are connected by a onetoMany. 

What I want to do is this:
    foreach($tasks as $task){
    echo $task->getTitle;
    echo $task->getTaskUser()->getFirstName();
    }


This is my query in the Task Repository:
 $qb = $this->_em->createQueryBuilder();   

 $qb
 ->select('t', 'tu')
 ->from('\Entities\Task', 't')
 ->leftJoin('\Entities\TaskUser', 'tu',  \Doctrine\ORM\Query\Expr\Join::WITH
, 't.id = tu.task')
 ->where('tu = :user')
 ->setParameter('user', $user)
 ->orderBy('t.createDate', 'DESC'); 

 return $qb->getQuery()->getResult(\Doctrine\ORM\Query::HYDRATE_OBJECT);


When I do this loop:
foreach($this->view->tasks as $task){
 echo $task->getTitle();
 }


I get the the title of the first task, and then an error like this:
    Title of first task
    Fatal error: Call to undefined method Entities\TaskUser::getTitle() in D
:\sites\db\application\controllers\TasksController.php on line 35


Any idea why this is happening? Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to