How to OrderBy on OneToMany/ManyToOne

后端 未结 4 594
粉色の甜心
粉色の甜心 2020-12-08 19:29

I have a Product class that has many fields on it for ManyToMany, such as ingredients, sizes, species, etc.. A total of about 14 different fields Not all of the fields are a

4条回答
  •  时光取名叫无心
    2020-12-08 20:06

    in the Product entity just also aadd the orderBy to the ingredients relation

    /**
     * ...
     * @ORM\OrderBy({"some_attribute" = "ASC", "another_attribute" = "DESC"})
     */
    private $ingredients;
    

提交回复
热议问题