/** * {@inheritdoc} */ public function getMapping() { $magentoAttributeMappings = $this->attributeMappingManager->getAllMagentoAttribute($this->clientParameters->getSoapUrl()); $attributeCodeMapping = $this->attributeCodeMappingMerger->getMapping(); $mappingCollection = new MappingCollection(); foreach ($magentoAttributeMappings as $magentoAttributeMapping) { $pimAttributeCode = $magentoAttributeMapping->getAttribute()->getCode(); $mappingCollection->add(['source' => $attributeCodeMapping->getTarget($pimAttributeCode), 'target' => $magentoAttributeMapping->getMagentoAttributeId(), 'deletable' => true]); } return $mappingCollection; }
/** * {@inheritdoc} */ public function getMapping() { $mapping = new MappingCollection(); if ($this->isValid()) { try { $attributes = $this->webserviceGuesser->getWebservice($this->clientParameters)->getAllAttributes(); } catch (SoapCallException $e) { return $mapping; } foreach ($attributes as $attribute) { $mapping->add(['source' => $attribute['code'], 'target' => $attribute['attribute_id'], 'deletable' => true]); } } return $mapping; }
/** * {@inheritdoc} */ public function getMapping() { if (!$this->isValid()) { return new MappingCollection(); } else { try { $attributes = $this->webserviceGuesser->getWebservice($this->clientParameters)->getAllAttributes(); } catch (SoapCallException $e) { return new MappingCollection(); } $mapping = new MappingCollection(); foreach (array_keys($attributes) as $attributeCode) { if (in_array($attributeCode, $this->mandatoryAttributes())) { $mapping->add(['source' => $attributeCode, 'target' => $attributeCode, 'deletable' => false]); } } return $mapping; } }