Form/DataTransformer/ProductPhotoCollectionToArrayTransformer.php
protected function getProductPhoto(MediaInterface $media, ProductInterface $modelData, $values)
    {
        $mainPhoto    = $this->isMainPhoto($media, $values['main']);
        $productPhoto = new ProductPhoto();
        $productPhoto->setPhoto($media);
        $productPhoto->setMainPhoto($mainPhoto);
        $productPhoto->setProduct($modelData);
        
        if ($mainPhoto) {
            $modelData->setPhoto($media);
        }
        
        return $productPhoto;
    }
protected function getProductPhoto(MediaInterface $media, ProductInterface $modelData, $values)
    {
        $mainPhoto    = $this->isMainPhoto($media, $values['main']);
        $productPhoto = new ProductPhoto();
        $productPhoto->setPhoto($media);
        $productPhoto->setMainPhoto($mainPhoto);
        $productPhoto->setProduct($modelData);
        
        if ($mainPhoto) {
            $modelData->setPhoto($media);
        }
        
        return $productPhoto;
    }
protected function getProductPhoto ( MediaInterface $ media , ProductInterface $ modelData , $ values ) { $ mainPhoto = $ this -> isMainPhoto ( $ media , $ values [ 'main' ] ) ; $ productPhoto = new ProductPhoto ( ) ; $ productPhoto -> setPhoto ( $ media ) ; $ productPhoto -> setMainPhoto ( $ mainPhoto ) ; $ productPhoto -> setProduct ( $ modelData ) ; if ( $ mainPhoto ) { $ modelData -> setPhoto ( $ media ) ; } return $ productPhoto ; }
Returns product photo model

@param MediaInterface   $media
@param ProductInterface $modelData
@param array            $values

@return ProductPhoto
Returns product photo model