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

发布于 2024-12-19 02:57:30 字数 630 浏览 3 评论 0原文

我想做,

$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 行,第 128 列“Pe”附近:错误:识别 变量 MyNameSpaceProfileBundle:连接路径表达式中使用的人员 但之前没有定义。 500 内部服务器错误 - QueryException

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

有什么帮助吗? 再见,

我不知道

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

I have followed the tutorial from symfony2 website.

ANY help please?
See ya

I have no idea

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空宴 2024-12-26 02:57:30

尝试这个可以让它工作:

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

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);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文