/** * 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); } }