/** * @return \WellCommerce\Bundle\ProductBundle\Entity\ProductInterface */ public function create() { $product = new Product(); $product->setCategories(new ArrayCollection()); $product->setProductPhotos(new ArrayCollection()); $product->setStatuses(new ArrayCollection()); $product->setAttributes(new ArrayCollection()); $product->setShops(new ArrayCollection()); $product->setEnabled(true); return $product; }
public function create() : ProductInterface { $product = new Product(); $product->setCategories($this->createEmptyCollection()); $product->setProductPhotos($this->createEmptyCollection()); $product->setDistinctions($this->createEmptyCollection()); $product->setVariants($this->createEmptyCollection()); $product->setShops($this->createEmptyCollection()); $product->setEnabled(true); $product->setSellPrice(new DiscountablePrice()); $product->setDimension(new Dimension()); $product->setBuyPrice(new Price()); $product->setBuyPriceTax(null); $product->setSellPriceTax(null); $product->setUnit(null); $product->setHierarchy(0); return $product; }