public function load(ObjectManager $manager) { $supports = $this->container->get('doctrine.orm.default_entity_manager')->getRepository('KoopaAppBundle:Support')->findAll(); $support = $supports[0]; foreach ($this->formules as $k => $v) { $formule = new Formule(); $formule->setName($v['name'])->setDebit($v['debit'])->setPricing($v['pricing'])->setSupport($support); $manager->persist($formule); } $support = $supports[count($supports) - 1]; foreach ($this->formules as $k => $v) { $formule = new Formule(); $formule->setName($v['name'])->setDebit($v['debit'])->setPricing($v['pricing'] + 49)->setSupport($support); $manager->persist($formule); } $manager->flush(); }
/** * Create Delete Form * * @param Formule $formule * @return \Symfonfy\Component\Form\Form */ public function createDeleteForm(Formule $formule) { return $this->createFormBuilder()->setAction($this->generateUrl('formule_delete', ['id' => $formule->getId()]))->setMethod('DELETE')->getForm(); }