gpt4 book ai didi

symfony - 注释@OrderBy

转载 作者:行者123 更新时间:2023-12-04 13:03:35 30 4
gpt4 key购买 nike

我正在尝试通过 ManyToMany 注释自动对报告的结果进行排序 @OrderBy :

/**
* @ORM\ManyToMany(targetEntity="Artist", inversedBy="soundtrack", cascade={"persist", "remove"})
* @ORM\JoinTable(name="soundtrack_artist")
* @OrderBy({"name" = "ASC", "surname" = "ASC"})
**/
private $artists;

但它给了我这个错误:
[Semantical Error] The annotation "@OrderBy" in property
Acme\UserBundle\Entity\Soundtrack::$artists was never imported.
Did you maybe forget to add a "use" statement for this annotation?

我还尝试添加:
use Doctrine\ORM\Mapping\OrderBy;

但错误仍然存​​在!
我做错了什么?

最佳答案

不确定你是否找到了答案,但这对我有用:

@ORM\OrderBy

关于symfony - 注释@OrderBy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18189996/

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