/** * {@inheritDoc} */ public function load(ObjectManager $manager) { $post = new Post(); $post->setTitle('Hollande en chut libre'); $post->setDescription("Hollande est en chute libre dans les sondages partout en France"); $manager->persist($post); $manager->flush(); }
/** * Create object * @param $title * @return RedirectResponse */ public function createPostAction($title) { $em = $this->getDoctrine()->getManager(); $post = new Post(); $post->setTitle($title); $em->persist($post); $em->flush(); $this->get('session')->getFlashBag()->add('notice', "<b>Success</b> Votre post a bie été crée"); return $this->redirect($this->generateUrl('twig')); }