Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid order by orientation

In my database I have the columns id, uid and data and I would like to sort id by DESC.

$this->getDoctrine()->getRepository(FormInputs::class)->findBy(['uid' => $uid], ['id', 'DESC']);

If I use the second parameter (['id', 'DESC']), I get the following error:

Invalid order by orientation specified for App\Entity\FormInputs#0

Why am I getting this error?

like image 442
Reza Saadati Avatar asked Oct 14 '19 11:10

Reza Saadati


1 Answers

Try Passing that like

$this->getDoctrine()->getRepository(FormInputs::class)->
findBy(
  array('uid'=>$uid),
  array('id'=>'DESC')
);
like image 154
Badrinath Avatar answered Nov 09 '22 17:11

Badrinath