dataMapperFactory = $dataMapperFactory; } /** * {@inheritdoc} */ public function map(array $documentData, $storeId, array $context = []) { $entityType = isset($context['entityType']) ? $context['entityType'] : Config::ELASTICSEARCH_TYPE_DEFAULT; return $this->getDataMapper($entityType)->map($documentData, $storeId, $context); } /** * Get instance of data mapper for specified entity type * * @param string $entityType * @return BatchDataMapperInterface * @throws NoSuchEntityException * @throws ConfigurationMismatchException */ private function getDataMapper($entityType) { if (!isset($this->dataMapperEntity[$entityType])) { $this->dataMapperEntity[$entityType] = $this->dataMapperFactory->create($entityType); } return $this->dataMapperEntity[$entityType]; } }