0
votes

I get a message : "Oops! An Error Occurred The server returned a "500 Internal Server Error". Something is broken. Please e-mail us at [email] and let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused" when persisting data to a database. Here is a controller:

public function registerAction()
{
    $register = new Register();
    $form = $this->createForm(new RegisterType(), $register);

    $request = $this->getRequest();
    if ($request->getMethod() == 'POST') 
    {
        $form->bindRequest($request);

        if ($form->isValid()) 
        {
            $em = $this->getDoctrine()->getEntityManager();
            $em->persist($register);
            $em->flush();

            return $this->redirect($this->generateUrl('ShopMyShopBundle_register'));
        }
    }

    return $this->render('ShopMyShopBundle:Main:register.html.twig', array('form' => $form->createView()));
}

Where is the problem ?

1
Have you checked your logs? What do they say? - richsage

1 Answers

1
votes

The code you provided is not enough to find the reason. You should develop using the dev environment to see detailed error messages. To do it, access your app with the app_dev.php front controller. See the section on environments.