/** * Retrieve select object for load object data * * @param string $field * @param mixed $value * @param \Magento\Framework\Model\AbstractModel $object * @return \Zend_Db_Select */ protected function _getLoadSelect($field, $value, $object) { if ($field == 'default_state') { $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), ['label'])->join(['state_table' => $this->stateTable], $this->getMainTable() . '.status = state_table.status', 'status')->where('state_table.state = ?', $value)->order('state_table.is_default DESC')->limit(1); } else { $select = parent::_getLoadSelect($field, $value, $object); } return $select; }
/** * Load quote data by identifier without store * * @param \Magento\Quote\Model\Quote $quote * @param int $quoteId * @return $this */ public function loadByIdWithoutStore($quote, $quoteId) { $read = $this->_getReadAdapter(); if ($read) { $select = parent::_getLoadSelect('entity_id', $quoteId, $quote); $data = $read->fetchRow($select); if ($data) { $quote->setData($data); } } $this->_afterLoad($quote); return $this; }