Example #1
0
 /**
  * Creates a form to edit a Post entity.
  *
  * @param Post $entity The entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createEditForm(Post $entity)
 {
     $formConfig = array();
     $user = $this->container->get('security.context')->getToken()->getUser();
     if ($user->isGranted('ROLE_MANAGER')) {
         $formConfig['projectIds'] = $this->get('admin_manager')->getProjectIds();
     }
     if ($entity->getPublished()->format('dmY') == '3011-0001') {
         $entity->setPublished(null);
     }
     $type = new PostType();
     $form = $this->createForm(new PostType($formConfig), $entity, array('action' => $this->generateUrl('core_blog_post_update', array('id' => $entity->getId())), 'method' => 'PUT', 'attr' => array('id' => $type->getName())));
     //        $form->add('submit', 'submit', array('label' => 'Update', 'attr' => array('class' => 'pull-right btn btn-success')));
     return $form;
 }