我正在尝试通过 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;
但错误仍然存在!我做错了什么?