src/Entity/Hydrator/ImageSetHydrator.php
public function hydrate(array $data, $object)
    {
        if (!isset($data['original']) || UPLOAD_ERR_OK !== $data['original']['error']) {
            return $object;
        }

        $data = $data['original'];
        $file  = $data['tmp_name'];

        $image = $this->imagine->open($file);
        $imageSpecs = $this->options->getImages();


        $images = [ ImageSetInterface::ORIGINAL => $this->createEntity($file, $data) ];

        foreach ($imageSpecs as $key => $size) {
            $newImage = ImageSetInterface::THUMBNAIL == $key
                ? $image->thumbnail(new Box($size[0], $size[1]), ImageInterface::THUMBNAIL_INSET)
                : $this->createImage($image, $size);

            if ($newImage) {
                $entity   = $this->createEntity($newImage, $data, $key);
                $images[$key] = $entity;
            }
        }

        $object->setImages($images);

        return $object;
    }
public function hydrate(array $data, $object)
    {
        if (!isset($data['original']) || UPLOAD_ERR_OK !== $data['original']['error']) {
            return $object;
        }

        $data = $data['original'];
        $file  = $data['tmp_name'];

        $image = $this->imagine->open($file);
        $imageSpecs = $this->options->getImages();


        $images = [ ImageSetInterface::ORIGINAL => $this->createEntity($file, $data) ];

        foreach ($imageSpecs as $key => $size) {
            $newImage = ImageSetInterface::THUMBNAIL == $key
                ? $image->thumbnail(new Box($size[0], $size[1]), ImageInterface::THUMBNAIL_INSET)
                : $this->createImage($image, $size);

            if ($newImage) {
                $entity   = $this->createEntity($newImage, $data, $key);
                $images[$key] = $entity;
            }
        }

        $object->setImages($images);

        return $object;
    }
public function hydrate ( array $ data , $ object ) { if ( ! isset ( $ data [ 'original' ] ) || UPLOAD_ERR_OK !== $ data [ 'original' ] [ 'error' ] ) { return $ object ; } $ data = $ data [ 'original' ] ; $ file = $ data [ 'tmp_name' ] ; $ image = $ this -> imagine -> open ( $ file ) ; $ imageSpecs = $ this -> options -> getImages ( ) ; $ images = [ ImageSetInterface :: ORIGINAL => $ this -> createEntity ( $ file , $ data ) ] ; foreach ( $ imageSpecs as $ key => $ size ) { $ newImage = ImageSetInterface :: THUMBNAIL == $ key ? $ image -> thumbnail ( new Box ( $ size [ 0 ] , $ size [ 1 ] ) , ImageInterface :: THUMBNAIL_INSET ) : $ this -> createImage ( $ image , $ size ) ; if ( $ newImage ) { $ entity = $ this -> createEntity ( $ newImage , $ data , $ key ) ; $ images [ $ key ] = $ entity ; } } $ object -> setImages ( $ images ) ; return $ object ; }
Hydrate $object with the provided $data.

@param  array  $data
@param  object $object

@return object
Hydrate $object with the provided $data .