/**
  * Does the actual import
  */
 public function import()
 {
     try {
         $SHOPWARE_id = PlentymarketsMappingController::getProducerByPlentyID($this->Producer->ProducerID);
         PyLog()->message('Sync:Item:Producer', 'Updating the producer »' . $this->Producer->ProducerName . '«');
     } catch (PlentymarketsMappingExceptionNotExistant $E) {
         PyLog()->message('Sync:Item:Producer', 'Skipping the producer »' . $this->Producer->ProducerName . '«');
         return;
     }
     /** @var Shopware\Models\Article\Supplier $Supplier */
     $Supplier = Shopware()->Models()->find('Shopware\\Models\\Article\\Supplier', $SHOPWARE_id);
     // Set the new data
     $Supplier->setName($this->Producer->ProducerName);
     Shopware()->Models()->persist($Supplier);
     Shopware()->Models()->flush();
 }
 /**
  * Sets the base item's data – not the details'
  */
 protected function setData()
 {
     // save the item texts for the shop main language
     $this->data = array();
     $this->data['name'] = $this->ItemBase->Texts->Name;
     $this->data['description'] = $this->ItemBase->Texts->ShortDescription;
     $this->data['descriptionLong'] = $this->ItemBase->Texts->LongDescription;
     $this->data['keywords'] = $this->ItemBase->Texts->Keywords;
     $this->data['highlight'] = $this->ItemBase->WebShopSpecial == 3;
     $this->data['lastStock'] = $this->ItemBase->Stock->Limitation == 1;
     $this->data['added'] = date('c', $this->ItemBase->Inserted);
     $this->data['changed'] = date('c', $this->ItemBase->LastUpdate);
     $this->data['availableTo'] = null;
     $this->data['active'] = $this->ItemBase->Availability->Inactive == 0 && $this->ItemBase->Availability->Webshop == 1;
     $this->data['taxId'] = $this->getTaxId();
     if ($this->ItemBase->Availability->AvailableUntil > 0) {
         $this->data['availableTo'] = date('c', $this->ItemBase->Availability->AvailableUntil);
     }
     try {
         $this->data['supplierId'] = PlentymarketsMappingController::getProducerByPlentyID($this->ItemBase->ProducerID);
     } catch (PlentymarketsMappingExceptionNotExistant $E) {
         if ($this->ItemBase->ProducerName) {
             $this->data['supplier'] = $this->ItemBase->ProducerName;
         } else {
             $this->data['supplierId'] = PlentymarketsConfig::getInstance()->getItemProducerID();
         }
     }
 }
 /**
  * Sets the base item's data – not the details'
  */
 protected function setData()
 {
     // save the item texts for the shop main language
     $this->data = array();
     $this->data['name'] = $this->getItemName($this->ItemBase->Texts);
     $this->data['description'] = PlentymarketsConfig::getInstance()->getItemShortDescriptionImportActionID(IMPORT_ITEM_SHORTDESC) == 1 ? $this->ItemBase->Texts->ShortDescription : '';
     $this->data['descriptionLong'] = PlentymarketsConfig::getInstance()->getItemLongDescriptionImportActionID(IMPORT_ITEM_LONGDESC) == 1 ? $this->ItemBase->Texts->LongDescription : '';
     $this->data['keywords'] = PlentymarketsConfig::getInstance()->getItemKeywordsImportActionID(IMPORT_ITEM_KEYWORDS) == 1 ? $this->ItemBase->Texts->Keywords : '';
     $this->data['highlight'] = $this->ItemBase->WebShopSpecial == 3;
     $this->data['lastStock'] = $this->ItemBase->Stock->Limitation == 1;
     $this->data['added'] = date('c', $this->ItemBase->Inserted);
     $this->data['changed'] = date('c', $this->ItemBase->LastUpdate);
     $this->data['availableTo'] = null;
     $this->data['active'] = $this->ItemBase->Availability->Inactive == 0 && $this->ItemBase->Availability->Webshop == 1;
     $this->data['taxId'] = $this->getTaxId();
     if ($this->ItemBase->Availability->AvailableUntil > 0) {
         $this->data['availableTo'] = date('c', $this->ItemBase->Availability->AvailableUntil);
     }
     try {
         $this->data['supplierId'] = PlentymarketsMappingController::getProducerByPlentyID($this->ItemBase->ProducerID);
     } catch (PlentymarketsMappingExceptionNotExistant $E) {
         if ($this->ItemBase->ProducerName) {
             $this->data['supplier'] = $this->ItemBase->ProducerName;
         } else {
             $this->data['supplierId'] = PlentymarketsConfig::getInstance()->getItemProducerID();
         }
     }
     // Allow plugins to change the data
     $this->data = Enlight()->Events()->filter('PlentyConnector_ImportEntityItem_AfterSetData', $this->data, array('subject' => $this, 'itembase' => $this->ItemBase, 'shop' => $this->Shop));
 }