【发布时间】:2015-06-01 22:09:29
【问题描述】:
我有一个应该返回 FK 的 DQL 查询。但是,即使使用 IDENTITY,我也遇到了查询错误。
我的实体字段:
//Profile.php
/**
* @ORM\OneToMany(targetEntity="\Gabrieljmj\ProfileBundle\Entity\Website\Website", mappedBy="profile", cascade={"remove", "persist"})
*/
private $websites;
//Website.php
/**
* @ORM\ManyToOne(targetEntity="\Gabrieljmj\ProfileBundle\Entity\Profile", inversedBy="websites")
* @ORM\JoinColumn(name="p_id", referencedColumnName="id")
*/
private $profile;
我的 DQL:
SELECT IDENTITY(p.websites)
FROM ProfileBundle:Profile AS p
WHERE p.u_id = :u_id
还有错误:
[Semantical Error] line 0, col 18 near 'websites) ':错误:无效的路径表达式。必须是 SingleValuedAssociationField。
我无法提供更多细节,因为这就是我所知道的全部。我搜索了类似的问题,但他们都没有使用 IDENTITY(这是他们的问题)。
【问题讨论】: