/** * @Route("/new", name="siswa_new") * @Template() */ public function newAction() { $this->setCurrentMenu(); $entity = new Siswa(); $orangtuaWali = new OrangtuaWali(); $entity->getOrangtuaWali()->add($orangtuaWali); $form = $this->createForm('sisdik_siswa', $entity, ['mode' => 'new']); return ['entity' => $entity, 'form' => $form->createView()]; }
/** * @Route("/new", name="applicant_new") * @Method("GET") * @Template() */ public function newAction() { $this->setCurrentMenu(); $panitiaAktif = $this->getPanitiaAktif(); if (!is_array($panitiaAktif) || count($panitiaAktif) <= 0) { throw new AccessDeniedException($this->get('translator')->trans('exception.tidak.ada.panitia.pendaftaran')); } if (!(is_array($panitiaAktif[0]) && in_array($this->getUser()->getId(), $panitiaAktif[0]) || $panitiaAktif[1] == $this->getUser()->getId())) { throw new AccessDeniedException($this->get('translator')->trans('exception.register.as.committee')); } $entity = new Siswa(); $orangtuaWali = new OrangtuaWali(); $entity->getOrangtuaWali()->add($orangtuaWali); $form = $this->createForm('sisdik_siswapendaftar', $entity, ['tahun_aktif' => $panitiaAktif[2], 'mode' => 'new']); return ['entity' => $entity, 'form' => $form->createView()]; }