Default sort attribute for Doctrine Model
问题 I was wondering if there is a way to declare the default order for my doctrine models. e.g. I have a work model and it has photos . When I load a work, all photos associated to it get loaded into $work->photos . When I display them, they are ordered by their IDs. It would be very convenient to declare a default order on another field or perhaps override the fetch behaviour altoghether. I'd rather not to convert the photos to an array and use usort. Thanks. 回答1: You can specify it in the YAML