src/Offer/Offer.php
public function selectMainImage(Image $image)
    {
        if (!$this->images->findImageByUUID($image->getMediaObjectId())) {
            throw new \InvalidArgumentException('You can not select a random image to be main, it has to be added to the item.');
        }

        $oldMainImage = $this->images->getMain();

        if (!isset($oldMainImage) || $oldMainImage->getMediaObjectId() !== $image->getMediaObjectId()) {
            $this->apply(
                $this->createMainImageSelectedEvent($image)
            );
        }
    }
public function selectMainImage(Image $image)
    {
        if (!$this->images->findImageByUUID($image->getMediaObjectId())) {
            throw new \InvalidArgumentException('You can not select a random image to be main, it has to be added to the item.');
        }

        $oldMainImage = $this->images->getMain();

        if (!isset($oldMainImage) || $oldMainImage->getMediaObjectId() !== $image->getMediaObjectId()) {
            $this->apply(
                $this->createMainImageSelectedEvent($image)
            );
        }
    }
public function selectMainImage ( Image $ image ) { if ( ! $ this -> images -> findImageByUUID ( $ image -> getMediaObjectId ( ) ) ) { throw new \ InvalidArgumentException ( 'You can not select a random image to be main, it has to be added to the item.' ) ; } $ oldMainImage = $ this -> images -> getMain ( ) ; if ( ! isset ( $ oldMainImage ) || $ oldMainImage -> getMediaObjectId ( ) !== $ image -> getMediaObjectId ( ) ) { $ this -> apply ( $ this -> createMainImageSelectedEvent ( $ image ) ) ; } }
Make an existing image of the item the main image.

@param Image $image
Make an existing image of the item the main image .