Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $id = $this->get('request')->get($this->admin->getIdParameter());
- $object = $this->admin->getObject($id);
- if (!$object) {
- throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
- }
- if (false === $this->admin->isGranted('EDIT', $object)) {
- throw new AccessDeniedException();
- }
- // On vérifie que l'annonce appartient bien à l'utilisateur connecté
- if($this->getUser()->getId() !== $object->getUser()->getId()) {
- throw new AccessDeniedException();
- }
- $em = $this->getDoctrine()->getManager();
- $preparechoices = $em->getRepository('AcmeBundle:Entity')->findAll();
- foreach($preparechoices as $c){
- $choices[$c->getId()] = $c->getLibelle();
- }
- $form = $this->createFormBuilder(array('choix'=>1))
- ->add('choix','choice',array('choices'=>$choices))
- ->add('submit','submit')
- ->getForm();
- $view = $form->createView();
- $this->admin->setSubject($object);
- $this->get('twig')->getExtension('form')->renderer->setTheme($view, $this->admin->getFormTheme());
- return $this->render($this->admin->getTemplate('EDIT'), array(
- 'action' => 'edit',
- 'object' => $object,
- 'form' => $view,
- ));
- }
- Impossible to access a key ("default") on a boolean variable ("")
- {{ form_helper.render_groups(admin, form, admin.formtabs['default'].groups, has_tab) }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement