/** * {@inheritdoc} */ public function getCurrentProductStatusId() { if (null === $this->productStatus) { throw new \LogicException('Cannot use this method before current status in provider is set.'); } return $this->productStatus->getId(); }
/** * {@inheritDoc} */ public function load(ObjectManager $manager) { foreach (self::$samples as $name) { $status = new ProductStatus(); $status->translate('en')->setName($name); $status->translate('en')->setSlug($slug = Sluggable::makeSlug($name)); $status->translate('en')->setCssClass($slug); $status->mergeNewTranslations(); $manager->persist($status); $this->addReference('product_status_' . $name, $status); } $manager->flush(); }
/** * @return \WellCommerce\Bundle\ProductBundle\Entity\ProductStatusInterface */ public function create() { $productStatus = new ProductStatus(); $productStatus->setProducts(new ArrayCollection()); return $productStatus; }