Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function addAction(Request $request)
- {
- $post = new Post();
- $form = $this->createFormBuilder($post)
- ->add('title', 'text')
- ->add('text', 'text')
- ->add('date', 'date')
- ->add('save', 'submit')
- ->getForm();
- $form->handleRequest($request);
- if($form->isValid()) {
- $em = $this->getDoctrine()->getManager();
- $em->persist($post);
- $em->flush();
- return new Response('Dodanie do bazy');
- }
- return $this->render('DudekmBlogBundle:Default:form.html.twig', array(
- 'form' => $form->createView()
- ));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement