/**
  * {@inheritdoc}
  */
 public function getMapping()
 {
     $prestashopAttributeMappings = $this->attributeMappingManager->getAllPrestashopAttribute($this->clientParameters->getPrestashopUrl());
     $attributeCodeMapping = $this->attributeCodeMappingMerger->getMapping();
     $mappingCollection = new MappingCollection();
     foreach ($prestashopAttributeMappings as $prestashopAttributeMapping) {
         $pimAttributeCode = $prestashopAttributeMapping->getAttribute()->getCode();
         $mappingCollection->add(['source' => $attributeCodeMapping->getTarget($pimAttributeCode), 'target' => $prestashopAttributeMapping->getPrestashopAttributeId(), 'deletable' => true]);
     }
     return $mappingCollection;
 }
 /**
  * Handle attribute creation and update.
  *
  * @param array             $attribute
  * @param AbstractAttribute $pimAttribute
  *
  * @throws InvalidItemException
  */
 protected function handleAttribute(array $attribute, $pimAttribute)
 {
     if (count($attribute) === self::ATTRIBUTE_UPDATE_SIZE) {
         $this->webservice->updateAttribute($attribute);
         $prestashopAttributeId = $this->attributeIdMappingMerger->getMapping()->getTarget($pimAttribute->getCode());
         $this->manageAttributeSet($prestashopAttributeId, $pimAttribute);
         $this->stepExecution->incrementSummaryInfo('attribute_updated');
     } else {
         $prestashopAttributeId = $this->webservice->createAttribute($attribute);
         $this->manageAttributeSet($prestashopAttributeId, $pimAttribute);
         $this->stepExecution->incrementSummaryInfo('attribute_created');
         $prestashopUrl = $this->getPrestashopUrl();
         $this->attributeMappingManager->registerAttributeMapping($pimAttribute, $prestashopAttributeId, $prestashopUrl);
     }
 }