Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function edit_articleAction(Request $request, $id)
- {
- $em = $this->getDoctrine()->getEntityManager();
- $article = $em->getRepository('PageNewsBundle:Article')
- ->find($id);
- if (!$article) {
- return $this->redirect($this->generateUrl('page_core_admin'));
- }
- $form = $this->createFormBuilder($article)
- ->add('title', 'text')
- ->add('subtitle', 'textarea')
- ->add('body','textarea', array('required' => false, 'attr' => array('class' => 'ckeditor')))
- ->add('articlecategory', 'entity', array(
- 'class' => 'PageNewsBundle:ArticleCategory',
- //'preferred_choices' => array($article->getArticlecategory()->getId()),
- ))
- ->getForm();
- if ($request->getMethod() == 'POST') {
- $form->bindRequest($request);
- if ($form->isValid()) {
- $em->flush();
- return $this->redirect($this->generateUrl('page_core_admin'));
- }
- }
- return $this->render('PageNewsBundle:Article:edit_article.html.twig', array(
- 'form' => $form->createView(),
- 'result' => $article,
- ));
- }
- Warning: spl_object_hash() expects parameter 1 to be object, string given in ...
Add Comment
Please, Sign In to add comment