/** * {@inheritdoc} */ public function setMasterVariant(VariantInterface $variant) { $variant->setMaster(true); if (!$this->variants->contains($variant)) { $variant->setProduct($this); $this->variants->push($variant); } return $this; }
/** * {@inheritdoc} */ public function setDefaults(VariantInterface $masterVariant) { if (!$masterVariant->isMaster()) { throw new \InvalidArgumentException('Cannot inherit values from non master variant.'); } if ($this->isMaster()) { throw new \LogicException('Master variant cannot inherit from another master variant.'); } return $this; }