I’m trying to add sort order filter in my order collection as you can see in this piece of code
$collection = $this->orderCollectionFactory->create()
->addAttributeToSelect('*')
->addAttributeToFilter('created_at', array('from' => $from, 'to' => $to))
->addAttributeToFilter("consignment_status", $orderStatus, "eq")
->addAttributeToFilter("status", $statusToGet, "in")
->setPageSize($this->_consignmentHelper->getGeneralPageSize())
->setOrder('entity_id', 'DESC')
->addAttributeToSort('entity_id', 'DESC');
echo $collection->getSelect()->__toString();
return $collection;
after that when i echo this i get the following query
SELECT `main_table`.* FROM `sales_order` AS `main_table` WHERE (`created_at` >= '2022-08-19' AND `created_at` <= '2022-08-23 05:18:07') AND (`consignment_status` = '1') AND (((((`status` = 'processing') OR (`status` = 'confirmed')))))
but no sorting order,buti’m using two sorting filters here, why is –>setOrder(‘entity_id’, ‘DESC’)
->addAttributeToSort(‘entity_id’, ‘DESC’)
these two are not showing?
any idea?