public function setMasterVariant(VariantInterface $masterVariant)
    {
        $masterVariant->setMaster(true);

        /** @var VariantInterface $variant */
        foreach ($this->variants as $variant) {
            if ($variant->isMaster() && $variant !== $masterVariant) {
                $variant->setMaster(false);
            }
        }

        if (!$this->variants->contains($masterVariant)) {
            $masterVariant->setObject($this);
            $this->variants->add($masterVariant);
        }

        return $this;
    }
public function setMasterVariant(VariantInterface $masterVariant)
    {
        $masterVariant->setMaster(true);

        /** @var VariantInterface $variant */
        foreach ($this->variants as $variant) {
            if ($variant->isMaster() && $variant !== $masterVariant) {
                $variant->setMaster(false);
            }
        }

        if (!$this->variants->contains($masterVariant)) {
            $masterVariant->setObject($this);
            $this->variants->add($masterVariant);
        }

        return $this;
    }
public function setMasterVariant ( VariantInterface $ masterVariant ) { $ masterVariant -> setMaster ( true ) ; /** @var VariantInterface $variant */ foreach ( $ this -> variants as $ variant ) { if ( $ variant -> isMaster ( ) && $ variant !== $ masterVariant ) { $ variant -> setMaster ( false ) ; } } if ( ! $ this -> variants -> contains ( $ masterVariant ) ) { $ masterVariant -> setObject ( $ this ) ; $ this -> variants -> add ( $ masterVariant ) ; } return $ this ; }
Set the master variant

@param VariantInterface $masterVariant

@return $this
Set the master variant