开发者

Access field in a many-to-many intermediate table with DQL in Doctrine

i have a model called ContentGroup and another called Content with a many-to-many relation between them.

The intermediate table has a field called Position, When i try to write a DQL query to obtain all the contents associated开发者_如何学编程 with a ContentGroup i cannot reference the position field usign the aliases of the models or relations involved.

someone try this?

thanks!


Consider intermediate model IntModel.

Didn't tested, but this should work:

$q = Doctrine::getTable('IntModel')->createQuery('p')
     ->leftJoin('p.Content as c')
     ->leftJoin('p.ContentGroup as cg')
     ->where('cg.id = ?', $my_content_group_id)->fetchOne();
echo $q->getPosition();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜