cakephp条件或订单排序不起作用

Code is not working condition is working but order sorting is not working

Please help me what is the issue

$this->Offer->find(
    'all',
    array(
        'conditions' => array(
            'OR' => array(
                array('Offer.branch_id' => 1),
                array('Offer.branch_id' => $branch['Branch']['id'])
            )
        )
    ),
    array('order' => array('Offer.order_no' => 'DESC'))
);

Try this code :->

$this->Offer->find(
    'all',
    array(
        'conditions' => array(
            'OR' => array(
                array('Offer.branch_id' => 1),
                array('Offer.branch_id' => $branch['Branch']['id'])
            )
        ),
        'order' => array('Offer.order_no' => 'DESC')
    )
);
$this->Offer->find('all', array(
    'conditions' => array(
        'OR' => array(
            'Offer.branch_id' => 1,
            'Offer.branch_id' => $branch['Branch']['id']
        )
    ),
    'order' => array('Offer.order_no DESC')
));
  1. In OR => array, there's no array again,
  2. Place the order after conditions, and make the format like 'order' => array('Offer.order_no DESC') ,

DESC = descending, is sort order_no from last ASC = ascending, sort from first