This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Pb with form after symfony 2.3 upgrade

Discuss installing Symfony 2 here

Pb with form after symfony 2.3 upgrade

by lucuhb » Thu Jul 11, 2013 11:47 am

Hi,

I upgraded from 2.2 to 2.3 symfony version and I have a big problem with all forms : no more form are displayed (even the smallest), only the title is displayed on the page. The others pages are correctly shown.
I didn't have these problems with the 2.2 version.

In the dev.log, I have no error but I get an error in apache log : PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 523800 bytes) in .../app/cache/dev/classes.php on line 10. In firebug , I get an internal servor error. The symfony profiler doens't appeared.
My memory limit is already on 512M, I tried with higher value but not better.

The problem appears once the
Code: Select all
{{ form(form) }}
or even
Code: Select all
{{ form_start(form) }}
{{ form_end(form) }}
is added in the twig template.

anyone have any idea ?
lucuhb
Junior Member
 
Posts: 6
Joined: Thu Jul 11, 2013 11:14 am

Re: Pb with form after symfony 2.3 upgrade

by lucuhb » Mon Jul 15, 2013 10:37 am

Nobody has this problem or a track of gathering ?
lucuhb
Junior Member
 
Posts: 6
Joined: Thu Jul 11, 2013 11:14 am

Re: Pb with form after symfony 2.3 upgrade

by lucuhb » Tue Dec 10, 2013 1:02 pm

I still have problems with forms after 2.3 version update.

Here is the error message in apache error log, event with the fewer form :
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 523800 bytes) in ../vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php on line 138,

exemple of controller :
Code: Select all
  public function removeStructureAction($id, $popup)
    {
       
       $structure = $this->getDoctrine()
       ->getRepository('ImpressionUserBundle:Structure')->find($id);
       
       // Ou null si aucun pro n'a été trouvé avec l'id $id
       if ($structure === null) {
          throw $this
          ->createNotFoundException(
                $translator->trans('user.edit_structure_inexistant',array('%id%' => $id)));
   
       }
   
   
       $form = $this->createFormBuilder()->getForm();
   
         $request = $this->get('request');
       $form->handleRequest($request);
   
       if ($form->isSubmitted()) {
          if ($form->isValid()) {
             
              $em->remove($structure);
                   $em->flush();
            return $this->redirect(
                   $this->generateUrl(
                         'impression_user_list_structures'));
                
          }//end form valid
       }// end sub
   
   
       return $this->render('ImpressionUserBundle:Structure:removeStructure.html.twig',
                array('form' => $form->createView(),
                      'structure' => $structure));
   
    }

and my twig template :
Code: Select all
{% extends "ImpressionAdminBundle::layout.html.twig" %}


{% block page_title %}{{ "user.remove_structure_page_title" | trans}} {% endblock %}

{% block body %}


 {% include "::message.html.twig" %}   

 
<form action="{{ path('impression_user_remove_structure' ,
            { 'id': structure.id }) }}" method="post" {{ form_enctype(form) }}>

 
    {{ form_rest(form) }}
 <div class="button">   
   <a href="{{ path('impression_user_list_structures' ) }}">{{ ("cancel" | trans) }}</a> <button id="submit-button" type="submit"> {{ ("confirm" | trans) }} </button>
</div>
   </form>
{% endblock %}


I thought there was a problem with template extension, but even I suppress the extends part of the twig template, I have the same error.

Can somebody give me an idea ?
lucuhb
Junior Member
 
Posts: 6
Joined: Thu Jul 11, 2013 11:14 am

Re: Pb with form after symfony 2.3 upgrade

by lucuhb » Wed Dec 18, 2013 10:33 am

This infinite recursion was provided by a call to form_div_layout.html.twig in a template with same name. Changing the name of my template solves the problem.
lucuhb
Junior Member
 
Posts: 6
Joined: Thu Jul 11, 2013 11:14 am