![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-sales/Model/ResourceModel/Order/Status/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Sales\Model\ResourceModel\Order\Status; /** * Flat sales order status history collection * * @author Magento Core Team <[email protected]> */ class Collection extends \Magento\Sales\Model\ResourceModel\Collection\AbstractCollection { /** * Internal constructor * * @return void */ protected function _construct() { $this->_init(\Magento\Sales\Model\Order\Status::class, \Magento\Sales\Model\ResourceModel\Order\Status::class); } /** * Get collection data as options array * * @return array */ public function toOptionArray() { return $this->_toOptionArray('status', 'label'); } /** * Get collection data as options hash * * @return array */ public function toOptionHash() { return $this->_toOptionHash('status', 'label'); } /** * Join order states table * * @return $this */ public function joinStates() { if (!$this->getFlag('states_joined')) { $this->_idFieldName = 'status_state'; $this->getSelect()->joinLeft( ['state_table' => $this->getTable('sales_order_status_state')], 'main_table.status=state_table.status', ['state', 'is_default', 'visible_on_front'] ); $this->setFlag('states_joined', true); } return $this; } /** * Add state code filter to collection * * @param string $state * @return $this */ public function addStateFilter($state) { $this->joinStates(); $this->getSelect()->where('state_table.state=?', $state); return $this; } /** * Define label order * * @param string $dir * @return $this */ public function orderByLabel($dir = 'ASC') { $this->getSelect()->order('main_table.label ' . $dir); return $this; } }