Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 protected function convertProperty($property, $data, array $convertedItem, array $options)
 {
     switch ($property) {
         case 'associations':
             $convertedItem = $this->convertAssociations($data, $convertedItem);
             break;
         case 'categories':
             $convertedItem[$property] = implode(',', $data);
             break;
         case 'enabled':
             $convertedItem[$property] = false === $data || null === $data ? '0' : '1';
             break;
         case 'family':
             $convertedItem[$property] = (string) $data;
             break;
         case 'groups':
         case 'variant_group':
             $convertedItem = $this->convertGroups($data, $convertedItem);
             break;
         case 'values':
             foreach ($data as $code => $attribute) {
                 $convertedItem = $convertedItem + $this->valueConverter->convertAttribute($code, $attribute);
             }
             break;
         default:
             $convertedItem = $convertedItem + $this->valueConverter->convertAttribute($property, $data);
     }
     return $convertedItem;
 }
 /**
  * {@inheritdoc}
  */
 protected function convertProperty($property, $data, array $convertedItem, array $options)
 {
     switch ($property) {
         case 'labels':
             foreach ($data as $localeCode => $label) {
                 $labelKey = sprintf('label-%s', $localeCode);
                 $convertedItem[$labelKey] = $label;
             }
             break;
         case 'axis':
             $convertedItem[$property] = implode(',', $data);
             break;
         case 'values':
             foreach ($data as $valueField => $valueData) {
                 $convertedItem = $convertedItem + $this->valueConverter->convertAttribute($valueField, $valueData);
             }
             break;
         case 'code':
         case 'type':
         default:
             $convertedItem[$property] = (string) $data;
             break;
     }
     return $convertedItem;
 }