/** * {@inheritdoc} */ public function normalize($object, $format = null, array $context = []) { $normalizedRequirements = $this->normalizeRequirements($object); $transNormalized = $this->transNormalizer->normalize($object, $format, $context); $defaults = ['code' => $object->getCode()]; $normalizedData = ['attributes' => $this->normalizeAttributes($object), 'attribute_as_label' => $object->getAttributeAsLabel() ? $object->getAttributeAsLabel()->getCode() : '']; return array_merge($defaults, $transNormalized, $normalizedData, $normalizedRequirements); }
/** * {@inheritdoc} */ public function normalize($object, $format = null, array $context = array()) { $results = array('type' => $object->getAttributeType(), 'code' => $object->getCode()) + $this->transNormalizer->normalize($object, $format, $context); $results = array_merge($results, array('group' => $object->getGroup() ? $object->getGroup()->getCode() : null, 'unique' => (int) $object->isUnique(), 'useable_as_grid_column' => (int) $object->isUseableAsGridColumn(), 'useable_as_grid_filter' => (int) $object->isUseableAsGridFilter(), 'allowed_extensions' => implode(self::ITEM_SEPARATOR, $object->getAllowedExtensions()), 'metric_family' => $object->getMetricFamily(), 'default_metric_unit' => $object->getDefaultMetricUnit())); if (isset($context['versioning'])) { $results = array_merge($results, $this->getVersionedData($object)); } else { $results = array_merge($results, array('localizable' => (int) $object->isLocalizable(), 'scopable' => (int) $object->isScopable())); } return $results; }
/** * {@inheritdoc} */ public function normalize($object, $format = null, array $context = array()) { $results = ['code' => $object->getCode(), 'type' => $object->getType()->getCode()]; $axisAttributes = $this->normalizeAxisAttributes($object); if (!empty($axisAttributes)) { $results += ['axis' => $axisAttributes]; } $results += $this->transNormalizer->normalize($object, $format, $context); if (isset($context['with_variant_group_values']) && true === $context['with_variant_group_values']) { $variantGroupValues = $this->normalizeVariantGroupValues($object, $format, $context); if (!empty($variantGroupValues)) { $results += $variantGroupValues; } } return $results; }
/** * {@inheritdoc} */ public function normalize($object, $format = null, array $context = []) { $data = ['code' => $object->getCode()] + $this->transNormalizer->normalize($object, $format, $context); $data['attributeAsLabel'] = $object->getAttributeAsLabel() ? $object->getAttributeAsLabel()->getCode() : null; return $data; }
/** * {@inheritdoc} */ public function normalize($object, $format = null, array $context = array()) { return array('code' => $object->getCode()) + $this->transNormalizer->normalize($object, $format, $context); }
/** * {@inheritdoc} */ public function normalize($object, $format = null, array $context = array()) { return array('code' => $object->getCode(), 'attributes' => $this->normalizeAttributes($object), 'attributeAsLabel' => $object->getAttributeAsLabel() ? $object->getAttributeAsLabel()->getCode() : '', 'requirements' => $this->normalizeRequirements($object)) + $this->transNormalizer->normalize($object, $format, $context); }
/** * {@inheritdoc} */ public function normalize($object, $format = null, array $context = []) { $data = ['code' => $object->getCode()] + $this->transNormalizer->normalize($object, $format, $context); return $data; }
/** * {@inheritdoc} */ public function normalize($object, $format = null, array $context = array()) { $results = array('code' => $object->getCode(), 'type' => $object->getType()->getCode(), 'attributes' => $this->normalizeAttributes($object)) + $this->transNormalizer->normalize($object, $format, $context); return $results; }
/** * {@inheritdoc} */ public function normalize($object, $format = null, array $context = array()) { return array('code' => $object->getCode(), 'sortOrder' => $object->getSortOrder(), 'attributes' => $this->normalizeAttributes($object)) + $this->transNormalizer->normalize($object, $format, $context); }
/** * {@inheritdoc} */ public function normalize($object, $format = null, array $context = []) { return ['code' => $object->getCode(), 'parent' => $object->getParent() ? $object->getParent()->getCode() : ''] + $this->transNormalizer->normalize($object, $format, $context); }