/**
  * {@inheritdoc}
  */
 public function modify(AbstractImportItem $eventItem, ItemPipelineEvent $event)
 {
     /** @var Article $article */
     $article = $eventItem->getEntity();
     $parent = $article->getParent();
     if ($parent && $parent->getId()) {
         ItemSkipper::skip($event, 'Ignore item variants');
         return;
     }
     /** @var ProductDocument $document */
     $document = $eventItem->getDocument();
     $document->setId($article->getId());
     $document->setActive($article->isActive());
     $document->setSku($article->getArtNum());
     $document->setTitle($article->getTitle());
     $document->setDescription($article->getShortDesc());
     $document->setPrice($article->getPrice());
     $document->setOldPrice($article->getTPrice());
     $document->setStock($article->getStock());
     $document->setAttributes($this->attrToDocService->transform($article->getAttributes()));
     $this->extractUrls($article, $document);
     $this->extractExtensionData($article, $document);
     $this->extractVendor($article, $document);
     $this->extractManufacturer($article, $document);
     $this->extractCategories($article, $document);
     $variants = $article->getVariants();
     if ($variants) {
         foreach ($variants as $variant) {
             $this->modifyVariant($document, $variant);
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 public function modify(AbstractImportItem $eventItem, ItemPipelineEvent $event)
 {
     /** @var Content $content */
     $content = $eventItem->getEntity();
     /** @var ContentDocument $document */
     $document = $eventItem->getDocument();
     $this->transformContentToDocument($content, $document);
 }
 /**
  * {@inheritdoc}
  */
 public function modify(AbstractImportItem $importItem, ItemPipelineEvent $event)
 {
     /** @var Category $category */
     $category = $importItem->getEntity();
     /** @var CategoryDocument $document */
     $document = $importItem->getDocument();
     $this->transformCategoryToDocument($category, $document);
 }
 /**
  * Assigns data in entity to relevant fields in document.
  *
  * @param AbstractImportItem $eventItem
  * @param ItemPipelineEvent  $event
  */
 protected function modify(AbstractImportItem $eventItem, ItemPipelineEvent $event)
 {
     /** @var TestProduct $data */
     $data = $eventItem->getEntity();
     /** @var Product $document */
     $document = $eventItem->getDocument();
     $document->setId($data->id);
     $document->setTitle($data->title);
     $document->setPrice($data->price);
     $document->setDescription($data->description);
 }
 /**
  * Assigns data in entity to relevant fields in document.
  *
  * @param AbstractImportItem $eventItem
  * @param ItemPipelineEvent $event
  */
 protected function modify(AbstractImportItem $eventItem, ItemPipelineEvent $event)
 {
     /** @var Product $data */
     $data = $eventItem->getEntity();
     /** @var Product $document */
     $document = $eventItem->getDocument();
     $document->setId($data->getId());
     $document->setFlower($data->getFlower());
     $document->setPlace($data->getPlace());
     $document->setStock($data->getStock());
 }
 /**
  * Persist document to Elasticsearch.
  *
  * @return bool
  */
 protected function persistDocument()
 {
     $this->manager->persist($this->importItem->getDocument());
     return true;
 }