Sort a doctrine's @OneToMany ArrayCollection
My question is close to this one , but does not exactly fit with mine. I've this column in an entity: /** * @var ArrayCollection[SubjectTag] * * @ORM\OneToMany(targetEntity="SubjectTag", mappedBy="subject") * @Assert\Count(max = 10, maxMessage = "You can't create more than 10 tags.") * @Assert\Valid() */ protected $subjectTags; I want to dynamically order my tags by a position, defined in SubjectTag.position . Try using the doctrine2 ORM functionality for Ordering To-Many Associations like this: /** * @var ArrayCollection[SubjectTag] * * @ORM\OneToMany(targetEntity="SubjectTag", mappedBy=