Symfony2 - 实体和检索信息之间的语义错误关系

时间:2011-12-01 08:58:28

标签: doctrine symfony doctrine-orm entity-relationship

我想制作

$this->getEntityManager()
->createQuery(' SELECT P.*  
            FROM    MyNameSpaceProfileBundle:Tutor T
                JOIN    MyNameSpaceProfileBundle:Person Pe 
                JOIN    MyNameSpaceMediaBundle:KidContent KC
                JOIN    MyNameSpaceMediaBundle:Post P
                WHERE T.id = :id'
)->setParameter('id', $pId);

但我有这样的错误:

  

[语义错误]第0行,第140页'Pe'附近:错误:识别   变量MyNameSpaceProfileBundle:连接路径表达式中使用的人员   但之前没有定义。 500内部服务器错误 - QueryException

我已经关注了symfony2网站的教程。

有什么帮助吗? 见你

我不知道

1 个答案:

答案 0 :(得分:0)

尝试这个使它工作:

$this->getEntityManager() ->createQuery(
  'SELECT P 
     FROM '.$this->_entityName.' P 
     JOIN P.details KC 
     JOIN KC.creator T 
     JOIN T.information Pe 
    WHERE Pe.id = :id' )->setParameter('id', $pId);