protected function execute(InputInterface $input, OutputInterface $output)
 {
     $aantal = $input->getOption('aantal');
     if (!$aantal) {
         $aantal = 30;
     }
     for ($i = 0; $i < $aantal; $i++) {
         $em = $this->getContainer()->get('doctrine.orm.entity_manager');
         $faker = Factory::create();
         $event = new Events();
         $event->setName($faker->name);
         $event->setAmount($faker->randomFloat());
         $event->setRemark($faker->realText(400, 2));
         if ($em->persist($event)) {
             $aantal--;
             $output->writeln($aantal);
         }
         $em->flush();
     }
 }
Exemple #2
0
 private function addEvent(\AppBundle\Entity\Events $e, $val)
 {
     $this->eventsList[] = ['id' => $e->getId(), 'userid' => $e->getUserid(), 'header' => $e->getDescription(), 'body' => $e->getDescription() . " " . round($val, 2), 'event' => $e];
 }
 /**
  * Creates a form to delete a Events entity.
  *
  * @param Events $event The Events entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(Events $event)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('events_delete', array('id' => $event->getId())))->setMethod('DELETE')->getForm();
 }