resourceModel = $resourceModel; $this->model = $model; parent::__construct( $entityFactory, $logger, $fetchStrategy, $eventManager, $storeManager, $metadataPool, $connection, $resource ); $this->_eventPrefix = $eventPrefix; $this->_eventObject = $eventObject; $this->_init($this->model, $this->resourceModel); $this->setMainTable($mainTable); $this->timeZone = $timeZone ?: ObjectManager::getInstance()->get(TimezoneInterface::class); } /** * @inheritDoc */ public function _resetState(): void { parent::_resetState(); $this->_init($this->model, $this->resourceModel); } /** * @inheritDoc */ public function addFieldToFilter($field, $condition = null) { if ($field === 'creation_time' || $field === 'update_time') { if (is_array($condition)) { foreach ($condition as $key => $value) { $condition[$key] = $this->timeZone->convertConfigTimeToUtc($value); } } } return parent::addFieldToFilter($field, $condition); } /** * Get aggregation interface instance * * @return AggregationInterface */ public function getAggregations() { return $this->aggregations; } /** * Set aggregation interface instance * * @param AggregationInterface $aggregations * @return $this */ public function setAggregations($aggregations) { $this->aggregations = $aggregations; return $this; } /** * Get search criteria. * * @return \Magento\Framework\Api\SearchCriteriaInterface|null */ public function getSearchCriteria() { return null; } /** * Set search criteria. * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null) { return $this; } /** * Get total count. * * @return int */ public function getTotalCount() { return $this->getSize(); } /** * Set total count. * * @param int $totalCount * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function setTotalCount($totalCount) { return $this; } /** * Set items list. * * @param \Magento\Framework\Api\ExtensibleDataInterface[] $items * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function setItems(array $items = null) { return $this; } }