So its simple like this : I have the following code in some Entity
/**
* @var ServiceOffer
*
* @ORM\OneToMany(targetEntity="ServiceOffer", mappedBy="serviceProvider")
* @ORM\OrderBy({"service" = "desc"})
*/
private $offers;
What i need is to do something like this
/**
* @var ServiceOffer
*
* @ORM\OneToMany(targetEntity="ServiceOffer", mappedBy="serviceProvider")
* @ORM\OrderBy({"service.points" = "desc"})
*/
private $offers;
which is not working i don't want to do it through some function i wanted straight forward with annotations is there any way to do this ?
this is the points btw:
/**
* @var integer
*
* @ORM\Column(name="points", type="integer", nullable=true)
*/
private $points;
No. This is not possible. You should solve this creating a dql.
More in doctrine2 documentation.
DQL Example
Notice, this code snippet
provider, offer, service
it's important to return here all entities or fields you will need so doctrine will load it for once, if it's possible. In other words, if you did'nt include any entity and call for it, doctrine will load it lazily.