- //Create ApplicationType form
- $applicationForm = $this->createForm('Rapsys\AirBundle\Form\ApplicationType', null, [
- //Set the action
- 'action' => $this->generateUrl('rapsys_air_application_add'),
- //Set the form attribute
- 'attr' => [ 'class' => 'col' ],
- //Set admin
- 'admin' => $this->isGranted('ROLE_ADMIN'),
- //Set default user to current
- 'user' => $this->getUser()->getId(),
- //Set default slot to current
- 'slot' => $this->getDoctrine()->getRepository(Slot::class)->findOneById($session['t_id']),
- //Set default location to current
- 'location' => $this->getDoctrine()->getRepository(Location::class)->findOneById($session['l_id']),
- ]);
-
- //Add form to context
- $this->context['forms']['application'] = $applicationForm->createView();
-