public function load(ObjectManager $manager)
    {
        /**
         * @var ProductInterface  $productWithVariants
         * @var CurrencyInterface $currency
         * @var ObjectDirector    $variantDirector
         */
        $currency = $this->getReference('currency-dollar');
        $productWithVariants = $this->getReference('product-with-variants');
        $variantDirector = $this->getDirector('product_variant');

        /**
         * @var ValueInterface $optionWhite
         * @var ValueInterface $optionRed
         * @var ValueInterface $optionSmall
         * @var ValueInterface $optionLarge
         */
        $optionWhite = $this->getReference('value-color-white');
        $optionRed = $this->getReference('value-color-red');
        $optionSmall = $this->getReference('value-size-small');
        $optionLarge = $this->getReference('value-size-large');

        /**
         * Variant White-Small.
         */
        $variantWhiteSmall = $variantDirector
            ->create()
            ->setSku('variant-white-small-sku')
            ->setStock(100)
            ->setProduct($productWithVariants)
            ->addOption($optionWhite)
            ->addOption($optionSmall)
            ->setPrice(Money::create(1500, $currency))
            ->setHeight(13)
            ->setWidth(12)
            ->setDepth(19)
            ->setWeight(125)
            ->setEnabled(true);

        $productWithVariants->setPrincipalVariant($variantWhiteSmall);

        $variantDirector->save($variantWhiteSmall);
        $this->addReference('variant-white-small', $variantWhiteSmall);

        /**
         * Variant White-Large.
         */
        $variantWhiteLarge = $variantDirector
            ->create()
            ->setSku('variant-white-large-sku')
            ->setStock(100)
            ->setProduct($productWithVariants)
            ->addOption($optionWhite)
            ->addOption($optionLarge)
            ->setPrice(Money::create(1800, $currency))
            ->setHeight(12)
            ->setWidth(11)
            ->setDepth(45)
            ->setWeight(155)
            ->setEnabled(true);

        $variantDirector->save($variantWhiteLarge);
        $this->addReference('variant-white-large', $variantWhiteLarge);

        /**
         * Variant Red-Small.
         */
        $variantRedSmall = $variantDirector
            ->create()
            ->setSku('variant-red-small-sku')
            ->setStock(100)
            ->setProduct($productWithVariants)
            ->addOption($optionRed)
            ->addOption($optionSmall)
            ->setPrice(Money::create(1500, $currency))
            ->setHeight(19)
            ->setWidth(9)
            ->setDepth(33)
            ->setWeight(1000)
            ->setEnabled(true);

        $this->storeProductImage(
            $variantRedSmall,
            'variant.jpg'
        );

        $variantDirector->save($variantRedSmall);
        $this->addReference('variant-red-small', $variantRedSmall);

        /**
         * Variant Red-Large.
         */
        $variantRedLarge = $variantDirector
            ->create()
            ->setSku('variant-red-large-sku')
            ->setStock(100)
            ->setProduct($productWithVariants)
            ->addOption($optionRed)
            ->addOption($optionLarge)
            ->setPrice(Money::create(1800, $currency))
            ->setHeight(50)
            ->setWidth(30)
            ->setDepth(18)
            ->setWeight(70)
            ->setEnabled(true);

        $variantDirector->save($variantRedLarge);
        $this->addReference('variant-red-large', $variantRedLarge);
    }
public function load(ObjectManager $manager)
    {
        /**
         * @var ProductInterface  $productWithVariants
         * @var CurrencyInterface $currency
         * @var ObjectDirector    $variantDirector
         */
        $currency = $this->getReference('currency-dollar');
        $productWithVariants = $this->getReference('product-with-variants');
        $variantDirector = $this->getDirector('product_variant');

        /**
         * @var ValueInterface $optionWhite
         * @var ValueInterface $optionRed
         * @var ValueInterface $optionSmall
         * @var ValueInterface $optionLarge
         */
        $optionWhite = $this->getReference('value-color-white');
        $optionRed = $this->getReference('value-color-red');
        $optionSmall = $this->getReference('value-size-small');
        $optionLarge = $this->getReference('value-size-large');

        /**
         * Variant White-Small.
         */
        $variantWhiteSmall = $variantDirector
            ->create()
            ->setSku('variant-white-small-sku')
            ->setStock(100)
            ->setProduct($productWithVariants)
            ->addOption($optionWhite)
            ->addOption($optionSmall)
            ->setPrice(Money::create(1500, $currency))
            ->setHeight(13)
            ->setWidth(12)
            ->setDepth(19)
            ->setWeight(125)
            ->setEnabled(true);

        $productWithVariants->setPrincipalVariant($variantWhiteSmall);

        $variantDirector->save($variantWhiteSmall);
        $this->addReference('variant-white-small', $variantWhiteSmall);

        /**
         * Variant White-Large.
         */
        $variantWhiteLarge = $variantDirector
            ->create()
            ->setSku('variant-white-large-sku')
            ->setStock(100)
            ->setProduct($productWithVariants)
            ->addOption($optionWhite)
            ->addOption($optionLarge)
            ->setPrice(Money::create(1800, $currency))
            ->setHeight(12)
            ->setWidth(11)
            ->setDepth(45)
            ->setWeight(155)
            ->setEnabled(true);

        $variantDirector->save($variantWhiteLarge);
        $this->addReference('variant-white-large', $variantWhiteLarge);

        /**
         * Variant Red-Small.
         */
        $variantRedSmall = $variantDirector
            ->create()
            ->setSku('variant-red-small-sku')
            ->setStock(100)
            ->setProduct($productWithVariants)
            ->addOption($optionRed)
            ->addOption($optionSmall)
            ->setPrice(Money::create(1500, $currency))
            ->setHeight(19)
            ->setWidth(9)
            ->setDepth(33)
            ->setWeight(1000)
            ->setEnabled(true);

        $this->storeProductImage(
            $variantRedSmall,
            'variant.jpg'
        );

        $variantDirector->save($variantRedSmall);
        $this->addReference('variant-red-small', $variantRedSmall);

        /**
         * Variant Red-Large.
         */
        $variantRedLarge = $variantDirector
            ->create()
            ->setSku('variant-red-large-sku')
            ->setStock(100)
            ->setProduct($productWithVariants)
            ->addOption($optionRed)
            ->addOption($optionLarge)
            ->setPrice(Money::create(1800, $currency))
            ->setHeight(50)
            ->setWidth(30)
            ->setDepth(18)
            ->setWeight(70)
            ->setEnabled(true);

        $variantDirector->save($variantRedLarge);
        $this->addReference('variant-red-large', $variantRedLarge);
    }
public function load ( ObjectManager $ manager ) { /**
         * @var ProductInterface  $productWithVariants
         * @var CurrencyInterface $currency
         * @var ObjectDirector    $variantDirector
         */ $ currency = $ this -> getReference ( 'currency-dollar' ) ; $ productWithVariants = $ this -> getReference ( 'product-with-variants' ) ; $ variantDirector = $ this -> getDirector ( 'product_variant' ) ; /**
         * @var ValueInterface $optionWhite
         * @var ValueInterface $optionRed
         * @var ValueInterface $optionSmall
         * @var ValueInterface $optionLarge
         */ $ optionWhite = $ this -> getReference ( 'value-color-white' ) ; $ optionRed = $ this -> getReference ( 'value-color-red' ) ; $ optionSmall = $ this -> getReference ( 'value-size-small' ) ; $ optionLarge = $ this -> getReference ( 'value-size-large' ) ; /**
         * Variant White-Small.
         */ $ variantWhiteSmall = $ variantDirector -> create ( ) -> setSku ( 'variant-white-small-sku' ) -> setStock ( 100 ) -> setProduct ( $ productWithVariants ) -> addOption ( $ optionWhite ) -> addOption ( $ optionSmall ) -> setPrice ( Money :: create ( 1500 , $ currency ) ) -> setHeight ( 13 ) -> setWidth ( 12 ) -> setDepth ( 19 ) -> setWeight ( 125 ) -> setEnabled ( true ) ; $ productWithVariants -> setPrincipalVariant ( $ variantWhiteSmall ) ; $ variantDirector -> save ( $ variantWhiteSmall ) ; $ this -> addReference ( 'variant-white-small' , $ variantWhiteSmall ) ; /**
         * Variant White-Large.
         */ $ variantWhiteLarge = $ variantDirector -> create ( ) -> setSku ( 'variant-white-large-sku' ) -> setStock ( 100 ) -> setProduct ( $ productWithVariants ) -> addOption ( $ optionWhite ) -> addOption ( $ optionLarge ) -> setPrice ( Money :: create ( 1800 , $ currency ) ) -> setHeight ( 12 ) -> setWidth ( 11 ) -> setDepth ( 45 ) -> setWeight ( 155 ) -> setEnabled ( true ) ; $ variantDirector -> save ( $ variantWhiteLarge ) ; $ this -> addReference ( 'variant-white-large' , $ variantWhiteLarge ) ; /**
         * Variant Red-Small.
         */ $ variantRedSmall = $ variantDirector -> create ( ) -> setSku ( 'variant-red-small-sku' ) -> setStock ( 100 ) -> setProduct ( $ productWithVariants ) -> addOption ( $ optionRed ) -> addOption ( $ optionSmall ) -> setPrice ( Money :: create ( 1500 , $ currency ) ) -> setHeight ( 19 ) -> setWidth ( 9 ) -> setDepth ( 33 ) -> setWeight ( 1000 ) -> setEnabled ( true ) ; $ this -> storeProductImage ( $ variantRedSmall , 'variant.jpg' ) ; $ variantDirector -> save ( $ variantRedSmall ) ; $ this -> addReference ( 'variant-red-small' , $ variantRedSmall ) ; /**
         * Variant Red-Large.
         */ $ variantRedLarge = $ variantDirector -> create ( ) -> setSku ( 'variant-red-large-sku' ) -> setStock ( 100 ) -> setProduct ( $ productWithVariants ) -> addOption ( $ optionRed ) -> addOption ( $ optionLarge ) -> setPrice ( Money :: create ( 1800 , $ currency ) ) -> setHeight ( 50 ) -> setWidth ( 30 ) -> setDepth ( 18 ) -> setWeight ( 70 ) -> setEnabled ( true ) ; $ variantDirector -> save ( $ variantRedLarge ) ; $ this -> addReference ( 'variant-red-large' , $ variantRedLarge ) ; }
Loads sample fixtures for product Variant entities.

@param ObjectManager $manager
Loads sample fixtures for product Variant entities .