public function load(ObjectManager $manager) { foreach (range(1, 100) as $i) { $product = new Product(); $product->setEnabled($i <= 90 ? true : false); $product->setName($this->getRandomName()); $product->setPrice($this->getRandomPrice()); $product->setTags($this->getRandomTags()); $product->setEan($this->getRandomEan()); $product->setDescription($this->getRandomDescription()); $product->setHtmlFeatures($this->getRandomHtmlFeatures()); $this->addReference('product-' . $i, $product); $manager->persist($product); } $manager->flush(); }
/** * Return the total price (tax included). * * @return float */ public function getTotalPrice() { return $this->product->getPrice() * $this->quantity * (1 + $this->taxRate); }