jsonHelper = $jsonHelper; $this->identifierResolver = $identifierResolver; parent::__construct( $entityFactory, $logger, $fetchStrategy, $eventManager, $mainTable, $resourceModel, $identifierName ); } /** * {@inheritdoc} */ protected function _initSelect() { $bulkUuid = $this->identifierResolver->execute(); $this->getSelect()->from(['main_table' => $this->getMainTable()], ['id', 'result_message', 'serialized_data']) ->where('bulk_uuid=?', $bulkUuid) ->where('status=?', OperationInterface::STATUS_TYPE_NOT_RETRIABLY_FAILED); return $this; } /** * {@inheritdoc} */ protected function _afterLoad() { parent::_afterLoad(); foreach ($this->_items as $key => $item) { try { $unserializedData = $this->jsonHelper->jsonDecode($item['serialized_data']); } catch (\Exception $e) { $this->_logger->error($e->getMessage()); $unserializedData = []; } $this->_items[$key]->setData('meta_information', $this->provideMetaInfo($unserializedData)); $this->_items[$key]->setData('link', $this->getLink($unserializedData)); $this->_items[$key]->setData('entity_id', $this->getEntityId($unserializedData)); } return $this; } /** * Provide meta info by serialized data * * @param array $item * @return string */ private function provideMetaInfo($item) { $metaInfo = ''; if (isset($item['meta_information'])) { $metaInfo = $item['meta_information']; } return $metaInfo; } /** * Get link from serialized data * * @param array $item * @return string */ private function getLink($item) { $entityLink = ''; if (isset($item['entity_link'])) { $entityLink = $item['entity_link']; } return $entityLink; } /** * Get entity id from serialized data * * @param array $item * @return string */ private function getEntityId($item) { $entityLink = ''; if (isset($item['entity_id'])) { $entityLink = $item['entity_id']; } return $entityLink; } }