/**
  * Compare product's association
  *
  * @param array  $originalAssociations original associations
  * @param array  $associations         product's associations
  * @param string $type                 type of association (PACK, SUBSTITUTION, etc)
  * @param string $key                  key of group (products or groups)
  *
  * @throws \LogicException
  *
  * @return array|null
  */
 protected function compareAssociation(array $originalAssociations, array $associations, $type, $key)
 {
     $comparator = $this->comparatorRegistry->getFieldComparator(ProductNormalizer::FIELD_ASSOCIATIONS);
     $diff = $comparator->compare($associations, $this->getOriginalAssociation($originalAssociations, $type, $key));
     if (null !== $diff) {
         return $diff;
     }
     return null;
 }
 /**
  * Compare product's association
  *
  * @param array  $originalValues original associations
  * @param array  $associations   product's associations
  * @param string $type           type of association (PACK, SUBSTITUTION, etc)
  * @param string $key            key of group (products or groups)
  *
  * @throws \LogicException
  *
  * @return array|null
  */
 protected function compareAssociation(array $originalValues, array $associations, $type, $key)
 {
     $comparator = $this->comparatorRegistry->getFieldComparator(self::ASSOCIATIONS_FIELD);
     $diff = $comparator->compare($associations, $this->getOriginalAssociation($originalValues, $type, $key));
     if (null !== $diff) {
         return $diff;
     }
     return null;
 }
 /**
  * Compare product's values
  *
  * @param array  $originalValues
  * @param array  $attribute
  * @param array  $attributeTypes
  * @param string $code
  *
  * @throws \LogicException
  *
  * @return array|null
  */
 protected function compareAttribute(array $originalValues, array $attribute, array $attributeTypes, $code)
 {
     $comparator = $this->comparatorRegistry->getAttributeComparator($attributeTypes[$code]);
     $result = [];
     foreach ($attribute as $data) {
         $diff = $comparator->compare($data, $this->getOriginalAttribute($originalValues, $data, $code));
         if (null !== $diff) {
             $result[$code][] = $diff;
         }
     }
     return !empty($result) ? $result : null;
 }