1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Quote\Model\ResourceModel\Quote\Address;
- /**
- * Quote addresses collection
- *
- * @author Magento Core Team <core@magentocommerce.com>
- */
- class Collection extends \Magento\Framework\Model\ResourceModel\Db\VersionControl\Collection
- {
- /**
- * Event prefix
- *
- * @var string
- */
- protected $_eventPrefix = 'sales_quote_address_collection';
- /**
- * Event object name
- *
- * @var string
- */
- protected $_eventObject = 'quote_address_collection';
- /**
- * Resource initialization
- *
- * @return void
- */
- protected function _construct()
- {
- $this->_init(
- \Magento\Quote\Model\Quote\Address::class,
- \Magento\Quote\Model\ResourceModel\Quote\Address::class
- );
- }
- /**
- * Setting filter on quote_id field but if quote_id is 0
- * we should exclude loading junk data from DB
- *
- * @param int $quoteId
- * @return $this
- */
- public function setQuoteFilter($quoteId)
- {
- $this->addFieldToFilter('quote_id', $quoteId ? $quoteId : ['null' => 1]);
- return $this;
- }
- /**
- * Redeclare after load method for dispatch event
- *
- * @return $this
- */
- protected function _afterLoad()
- {
- parent::_afterLoad();
- $this->_eventManager->dispatch($this->_eventPrefix . '_load_after', [$this->_eventObject => $this]);
- return $this;
- }
- }
|