I've been following this tutorial to create a registration form with Symfony 2.5.
The only difference I made, was an additional field for the username in my User
class and rendering it in the UserType
form.
When submitting the form to the account_create
-route (which ultimately uses the create
action in the Account controller) it won't properly handle the form. The page shows up blank, not even the profiler shows up anymore.
Additionally it seems like the script breaks my Apache (I'm running this locally on Windows via XAMPP), as everything I try to do after submitting the form once results in endless loading. This means that no matter which page on my server I try to access next (even if it's just the profiler), I can't. It just keeps loading forever (I've been waiting over 10 minutes once). Only a Apache restart helped then.
This is my createAction inside the 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 only outputs Doctrine managed. Form created.
, so apparently it crashes when calling the handleRequest($request)
method.
What is it, that's so horribly wrong?
Tell me if you need the code of any other scripts!