php - Symfony form submission doesn't work -
i've been following this tutorial create registration form symfony 2.5.
the difference made, additional field username in user
class , rendering in usertype
form.
when submitting form account_create
-route (which uses create
action in account controller) won't handle form. page shows blank, not profiler shows anymore.
additionally seems script breaks apache (i'm running locally on windows via xampp), try after submitting form once results in endless loading. means no matter page on server try access next (even if it's profiler), can't. keeps loading forever (i've been waiting on 10 minutes once). apache restart helped then.
this createaction inside account controller
// 'account_create' route // testbundle:account:create public function createaction(request $request) { $em = $this->getdoctrine()->getmanager(); echo "doctrine managed. "; $form = $this->createform(new registrationtype(), new registration()); echo "form created. "; $form->handlerequest($request); echo "request handled. "; if ($form->isvalid()) { $registration = $form->getdata(); echo "form data received. "; $em->persist($registration->getuser()); echo "user persisted. "; $em->flush(); echo "toilet flushed. "; return $this->redirect($this->generateurl('admin_page')); } return $this->render( 'testbundle:account:register.html.twig', array('form' => $form->createview()) ); }
it outputs doctrine managed. form created.
, apparently crashes when calling handlerequest($request)
method.
what it, that's horribly wrong?
tell me if need code of other scripts!
i know not the answer, anyway not fitting comment , important step debug this
put handle request in try block , echo exception
try { $form->handlerequest($request); } catch (\exception $e) { echo "failed : ".$e->getmessage(); }
what exception throwed ?
Comments
Post a Comment