| Conditions | 4 |
| Paths | 6 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | protected function normalizeProduct(EntityWithFamilyVariantInterface $product) |
||
| 17 | { |
||
| 18 | $normalizedProduct = $this->getNormalizer()->normalize($product, 'standard'); |
||
| 19 | |||
| 20 | while ($parent = $product->getParent()) { |
||
| 21 | foreach ($parent->getValuesForVariation() as $value) { |
||
| 22 | //this workaround removes the attributes of all parent models, as the getValues() Method, |
||
| 23 | // which is called by the normalizer, returns all Values including the values of the parent Model |
||
| 24 | unset($normalizedProduct['values'][$value->getAttribute()->getCode()]); |
||
| 25 | } |
||
| 26 | $product = $parent; |
||
| 27 | }; |
||
| 28 | |||
| 29 | foreach ($this->getAttributeRepository()->findUniqueAttributeCodes() as $attributeCode) { |
||
| 30 | unset($normalizedProduct['values'][$attributeCode]); |
||
| 31 | } |
||
| 32 | unset($normalizedProduct['identifier']); |
||
| 33 | return $normalizedProduct; |
||
| 34 | } |
||
| 36 |