Symfony inner join
How do we write an inner join query in symfony?
$tagQuery = Do开发者_如何学JAVActrine_Query::create()
->from('SfTagging t')
->innerjoin('t.Link L ON t.taggable_id=L.id');
echo $tagQuery->getSqlQuery();
You don't need to specify the ON part, doctrine already knows how to make the join if your schema is not too bad. I'd write it like this:
$tagQuery = SfTaggingTable::getInstance()
->createQuery('t')
->innerJoin('t.Link');
echo $tagQuery->getSqlQuery();
$tagQuery = Doctrine_Query::create()
->from('SfTagging t')
->innerJoin('t.Link l');
echo $tagQuery->getSqlQuery();
精彩评论