Doctrine Join DQL

Posted by koko on Stack Overflow See other posts from Stack Overflow or by koko
Published on 2010-06-21T14:57:40Z Indexed on 2010/12/21 8:54 UTC
Read the original article Hit count: 295

Filed under:
|
|
|

I's like to do a join between 2 tables on a specific ID. At the moment, I have this DQL:

$q = Doctrine_Query::create()
         ->select('e.*, i.itemName, i.itemtypeId')
         ->from('Model_EventItem e')
         ->leftJoin('Model_Item i ON e.itemId = i.itemId')
         ->where('e.eventitemId = ?', $event->eventId)
         ->orderBy('i.itemName ASC');

The result is empty, although my eventId has a value ... Can you help me please? I there somewhere a tutorial on DQL-joins? I don't get it right with the help of the Doctrine documentation.

Thanks!

PS I have doctrine working in combination with Zend Framework.

© Stack Overflow or respective owner

Related posts about php

Related posts about zend-framework