i have relation ManyToOne between two entity Collaborateur and Conge.
/**
* @ORM\ManyToOne(targetEntity="Collaborateur", inversedBy="collaborateur", cascade={"remove"})
* @ORM\JoinColumn(name="collaborateur_id", referencedColumnName="id")
*/
protected $collaborateur;
In my CongeManager i have this function:
public function findCongeByCollaborateur ($collaborateur){
return $this->getRepository()->findOneBy(array('collaborateur'=>$collaborateur));
}
it return just the first element of Conge i want to get the last one .
$this->getRepository()->findOneBy(
array('collaborateur'=>$collaborateur),
array('id' => 'DESC')
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With