Form/DataTransformer/ProductPhotoCollectionToArrayTransformer.php
public function reverseTransform($modelData, PropertyPathInterface $propertyPath, $values)
    {
        if (!$modelData instanceof ProductInterface) {
            throw new \InvalidArgumentException(sprintf('Wrong entity passed "%s"', get_class($modelData)));
        }
        
        if ($this->isPhotoCollectionUnModified($values)) {
            return false;
        }
        
        $previousCollection = $this->propertyAccessor->getValue($modelData, $propertyPath);
        $this->clearPreviousCollection($previousCollection);
        
        $collection = $this->createPhotosCollection($modelData, $values);
        
        if (0 === $collection->count()) {
            $modelData->setPhoto(null);
        }
        
        $this->propertyAccessor->setValue($modelData, $propertyPath, $collection);
    }
public function reverseTransform($modelData, PropertyPathInterface $propertyPath, $values)
    {
        if (!$modelData instanceof ProductInterface) {
            throw new \InvalidArgumentException(sprintf('Wrong entity passed "%s"', get_class($modelData)));
        }
        
        if ($this->isPhotoCollectionUnModified($values)) {
            return false;
        }
        
        $previousCollection = $this->propertyAccessor->getValue($modelData, $propertyPath);
        $this->clearPreviousCollection($previousCollection);
        
        $collection = $this->createPhotosCollection($modelData, $values);
        
        if (0 === $collection->count()) {
            $modelData->setPhoto(null);
        }
        
        $this->propertyAccessor->setValue($modelData, $propertyPath, $collection);
    }
{@inheritdoc}