Hi all.
I'm trying to get field values in my View after having done multiple
joins between some tables (models) but i don't know how to do..
I have three tables: Interview, Answer and Question.
I want to show a single interview with all the Questions and the
Answers related to that Interview (by the way, every Answer has got a
related Question).
So in my actions i have:
public function executeShow(sfWebRequest $request)
{
$this->interview = Doctrine::getTable('Interview')->find($request-
>getParameter('id'));
$this->answers = Doctrine::getTable('Interview')->getAnswers
($request->getParameter('id'));
$this->forward404Unless($this->interview);
}
And in my InterviewTable.class.php:
public function getAnswers($id){
$q = Doctrine_Query::create()
->from('Answer a')
->leftJoin('a.Question q')
->leftJoin('a.Interview i')
->where('a.idInterview = ?', $id );
return $q->execute();
}
But how do i do to get a parameter of Question in the View code?
If i do:
<?php foreach ($answers as $p ): ?>
<?php echo $p->getAnswerField() ?>
<?php echo $p->getQuestionField() ?>">
<?php endforeach; ?>
it gives me this error:
Unknown method Answer::getQuestionField
Of Course - i say - QuestionField is in Question model not in Answer
one!! but i don't know how to make it works..
Thank you in advance and sorry for my poor english. I hope you have
understood what i want to say..
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---