hello all,

I am using Symfony with Doctrine plugin. I have been having trouble in
fetching the data in view layer where the object contains results of a
DQL with innerjoins.

Here is my scenario....

Tables: Topics, Posts, SubTopics
Ids: topic_id, post_id, subtopic_id

Relations:
-------------------------------------------------------
Topics -- have --> Posts
Topics -- have --> SubTopics

Controller layer: actions.class.php
-------------------------------------------------------
public function executeShow(sfWebRequest $request)
{
   $this-> topic_list = Doctrine::getTable( 'Topics' )
     -> getTopicsList ( $request->getParameter('id') );
}

View Layer: showSuccess.php
-------------------------------------------------------
<h1> <?php echo $topic_list -> getTopic() ?> </h1>

<!-- This always gives an error. Warning: call_user_func_array()
[function.call-user-func-array]: First argument is expected to be a
valid callback, 'Doctrine_Collection::getTopic' was given in C:\xampp
\php\PEAR\symfony\view\escaper
\sfOutputEscaperObjectDecorator.class.php on line 64 -->

<table>
  <?php foreach($topic_list as $i => $items): ?>
    <tr>
      <td><?php echo $items->getBody() ?></td>
      <!-- This doesn't work either. ->
    </tr>
  <?php endforeach; ?>
</table>


Model Layer: TopicsTable.class.php
-------------------------------------------------------
public function getTopicsList($id)
{
   $q = $this->createQuery( 't' )
      ->innerJoin( 't.Posts p' ) ->innerJoin( 't.SubTopics st' )
      -> where( 't.topic_id =?' , $id);
  return $q->execute();
}


I understand this much that since the object has been hydrated, that
is why I am not able to access the properties properly.
But then how can I?
I tried using the magic methods of Doctrine, instead of doing the taks
in model layer. That surely solve my problem, but only for the time
being. Because they are of no help when I have joins to perform.

Can anybody help me out with this by giving some suggestions? I am
guessing the model and controller layers are fine. The problem lies in
view layer, when I have to access the properties.

Thanks and Regards
Vikram
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to