An example how to do this is in Practical Symfony jobeet 1.4
(doctrine), but I don't remember the chapter..


On 21 dub, 15:11, comb <[email protected]> wrote:
> Hi
>
> Tables: Gig, Song and GigSong (many-to-many).
>
> I use a pager and in executeIndex I set up the Query:
>
>                 $q = Doctrine_Query::create()
>                 ->from('Gig g')
>                 ->leftJoin('g.GigSong gs ON gs.gig_id = g.id')
>                 ->orderBy('gs.order_id ASC');
>
>                 $this->pager->setQuery($q);
>                 ...
>
> On the indexSuccess page there will be a call $gig->getSongs() for
> each gig.
> class Gig ..
>         public function getSongs()
>         {
>                 $q = Doctrine_Query::create()
>                 ->from('Song s')
>                 ->leftJoin('s.GigSong gs ON s.id = gs.song_id')
>                 ->andWhere('gs.gig_id = ?', $this->id)
>                 ->orderBy('gs.order_id ASC');
>                 return $q->execute();
>         }
>
> This results in 25 queries. How can I join the songs in the first
> query?
>
> In advance
> comb
>
> --
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
>
> 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 
> athttp://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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