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

时间:2022-02-11 06:48:34

I want to make

我要实现

$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);

but I have this kind of error:

但我有这种错误:

[Semantical Error] line 0, col 128 near 'Pe ': Error: Identification Variable MyNameSpaceProfileBundle:Person used in join path expression but was not defined before. 500 Internal Server Error - QueryException

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

I have followed the tutorial from symfony2 website.

我已经按照symfony2网站的教程进行了操作。

ANY help please? See ya

有什么帮助吗?再见

I have no idea

我不知道

1 个解决方案

#1


0  

Trying this makes it work:

尝试这个使它工作:

$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);

#1


0  

Trying this makes it work:

尝试这个使它工作:

$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);