public function load(ObjectManager $manager) { $page = new Page(); $page->setTitle('title'); $page->setBody('body'); $manager->persist($page); $manager->flush(); self::$pages[] = $page; }
protected function execute(InputInterface $input, OutputInterface $output) { $em = $this->getContainer()->get('doctrine')->getManager(); for ($i = 0; $i < 50; $i++) { $page = new Page(); $page->setTitle('Some title ' . rand(1, 10000)); $page->setBody('Some Body yea ' . rand(1, 10000)); $em->persist($page); $em->flush(); } }
public function load(ObjectManager $em) { $page = new Page(); $page->setTitle('this is example title'); $page->setBody('this is example body'); $em->persist($page); $page = new Page(); $page->setTitle('another awesome title'); $page->setBody('is this a body, or?...'); $em->persist($page); $em->flush(); }