I have a very strange problem that looks like this:
[2014-11-06 11:21:13] request.INFO: Matched route "core_timetracking_new_user" (parameters: "_controller": "Bricks\Custom\CoreBundle\Controller\TimeTrackingController::newuserAction", "_route": "core_timetracking_new_user") [] [] [2014-11-06 11:21:13] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Failed to start the session: already started by PHP." at /var/cache/app/prod/classes.php line 113 {"exception":"[object] (RuntimeException: Failed to start the session: already started by PHP. at /var/cache/app/prod/classes.php:113)"} []
strange thing: I do not start a session or do not use it, here is the controller code:
public function newuserAction() { $trackingService=$this->get('core.timetracking_service'); $user= new TimeTrackingUser(); $request=$this->getRequest(); $form = $this->createFormBuilder($user) ->add('name','text') ->add('email','text') ->add('pass','password') ->add('save', 'submit', array('label' => 'Erstellen')) ->getForm(); $form->handleRequest($request); if ($form->isValid()) { $trackingService->persistUser($form->getData()); return $this->redirect($this->generateUrl('core_timetracking_user_list')); }else { return array( 'form' => $form->createView() ); } }
while this action works great
public function listuserAction() { $request=$this->getRequest(); $trackingService=$this->get('core.timetracking_service'); $users=$trackingService->getAllUsers(); return array( 'users' => $users ); }
so the only difference is that i use
$form->handleRequest($request);
it also checks to see if all my AppKernel files, etc. start with
both actions (working and non-working) are in one controller
source share