Close question was enter link description here but I need to more deep sorting:
/**
* @var ArrayCollection[SubjectTag]
*
* @ORM\OneToMany(targetEntity="SubjectTag", mappedBy="subject")
* @ORM\OrderBy({"position" = "ASC"})
* @Assert\Valid()
*/
protected $subjectTags;
In subjectTag I have:
/**
* @var ArrayCollection[tag]
*
* @ORM\OneToMany(targetEntity="Tag", mappedBy="subject")
* @ORM\OrderBy({"name" = "ASC"})
* @Assert\Valid()
*/
protected $tags;
Now I want to sort by SubjectTag.tags. How can I do that?
EDIT:
Entity1.php: /** * @ORM\ManyToOne(targetEntity="Entity2", referencedColumnName="id", nullable=false) * @Assert\Valid() */ protected $entity2;
Entity2.php: /** * @ORM\ManyToOne(targetEntity="Entity3", referencedColumnName="id", nullable=false) * @Assert\Valid() */ protected $entity3;
Entity3.php:
/**
* @ORM\Column(type="integer", nullable=true)
*/
protected $position;
And now.. I want have in Entity1 Entity2 sorted by position. How can I do that by default?