gpt4 book ai didi

php - 仅在生产中空左连接

转载 作者:行者123 更新时间:2023-11-29 20:24:51 25 4
gpt4 key购买 nike

我有一个在 symfony2 上运行的网站。

我有这个 dql 查询:

SELECT b, d, al, a 
FROM Bundle:Book b
LEFT JOIN b.document d
LEFT JOIN b.authorLinks al
LEFT JOIN al.author a
WHERE d.type = 'summary'
ORDER BY b.name ASC

在本地我没有任何问题,但在生产中我遇到了这个问题:

... LEFT JOIN LEFT JOIN ...

因此,第一个 LEFT JOIN(b.document d)在生产环境中不起作用,但在本地运行良好......(其他 LEFT JOIN(authorLinks 和作者)都适用)

我的Book实体有:

/**
* @var \Doctrine\Common\Collections\ArrayCollection
*
* @ORM\OneToMany(targetEntity="Document", mappedBy="book")
* @ORM\OrderBy({"name" = "ASC"})
*/
protected $document;

我的Document实体有:

/**
* @var Book
*
* @ORM\ManyToOne(targetEntity="Book", inversedBy="document")
* @ORM\JoinColumn(name="book_id", referencedColumnName="id", nullable=true)
* @Assert\NotBlank
*/
protected $book;

有什么想法吗?谢谢

最佳答案

解决了!

我在“LEFT JOIN b.document d”之后添加了“with d.book_id = b.id”

并添加

/**
* @var book_id
* @ORM\Column(name="book_id", type="integer")
* @Assert\NotBlank
*/
protected $book_id;

在文档实体中

谢谢大家!

关于php - 仅在生产中空左连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39348737/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com