public function setOptions(Collection $options)
    {
        /**
         * We want to be able to assign an empty
         * ArrayCollection to variant options.
         *
         * When the collection is not empty, each
         * option in the collection will be added
         * separately since it needs to update the
         * parent product attribute list
         */
        if ($options->isEmpty()) {
            $this->options = $options;
        } else {
            $this->options->clear();
        }

        /**
         * @var ValueInterface $option
         */
        foreach ($options as $option) {

            /**
             * We need to update the parent product attribute collection.
             */
            $this->addOption($option);
        }

        return $this;
    }
public function setOptions(Collection $options)
    {
        /**
         * We want to be able to assign an empty
         * ArrayCollection to variant options.
         *
         * When the collection is not empty, each
         * option in the collection will be added
         * separately since it needs to update the
         * parent product attribute list
         */
        if ($options->isEmpty()) {
            $this->options = $options;
        } else {
            $this->options->clear();
        }

        /**
         * @var ValueInterface $option
         */
        foreach ($options as $option) {

            /**
             * We need to update the parent product attribute collection.
             */
            $this->addOption($option);
        }

        return $this;
    }
public function setOptions ( Collection $ options ) { /**
         * We want to be able to assign an empty
         * ArrayCollection to variant options.
         *
         * When the collection is not empty, each
         * option in the collection will be added
         * separately since it needs to update the
         * parent product attribute list
         */ if ( $ options -> isEmpty ( ) ) { $ this -> options = $ options ; } else { $ this -> options -> clear ( ) ; } /**
         * @var ValueInterface $option
         */ foreach ( $ options as $ option ) { /**
             * We need to update the parent product attribute collection.
             */ $ this -> addOption ( $ option ) ; } return $ this ; }
Sets this variant option values.

@param Collection $options

@return $this Self object
Sets this variant option values .