title: symfony 3.4 form insert to database error500
body: <p>I have problem with symfony 3.4... it should pretty simple but... The thing is that when i trying to create simple form and insert data to mysql database AFTER SUBMIT i get error500. Project is already at LIVE server, not localy, so i can`t automatically generate route to function with composer, i wrote it manually. Form renders fine. Mysql fields is id- int(11) AI and title- varchar(255).</p>
  
  <p><strong>My Form class:</strong> </p>
  
  <pre><code>
  use AppBundle\Entity\IndexAdvantage;
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\Extension\Core\Type\TextType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\OptionsResolver\OptionsResolver;
  
  class IndexAdvantageType extends AbstractType
  {
      /**
       * {@inheritdoc}
       */
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add('title', TextType::class, ['label' =&gt; 'Title'])
          ;
      }
  
      /**
       * {@inheritdoc}
       */
      public function configureOptions(OptionsResolver $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'data_class' =&gt; 'AppBundle\Entity\IndexAdvantage'
          ));
      }
  
      /**
       * {@inheritdoc}
       */
      public function getBlockPrefix()
      {
          return 'appbundle_index_advantage';
      }
  }
  </code></pre>
  
  <p><strong>My Entity:</strong> <em>AppBundle\Entity\IndexAdvantage.php</em></p>
  
  <pre><code>namespace AppBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use Gedmo\Mapping\Annotation as Gedmo;
  
  /**
   * @ORM\Table(name="index_advantage")
   * @ORM\Entity(repositoryClass="AppBundle\Repository\IndexAdvantageRepository")
   */
  class IndexAdvantage
  {
      /**
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @ORM\Column(name="title", type="string", length=255)
       */
      private $title;
  
      /**
       * @return int|null
       */
      public function getId(): ?int
      {
          return $this-&gt;id;
      }
  
      /**
       * @return string
       */
      public function getTitle()
      {
          return $this-&gt;title;
      }
  
      /**
       * @param string $title
       * @return $this
       */
      public function setTitle($title)
      {
          $this-&gt;title = $title;
          return $this;
      }
  }
  </code></pre>
  
  <p><strong>My controller</strong> AppBundle\Controller\Admin\IndexController.php</p>
  
  <pre><code>namespace AppBundle\Controller\Admin;
  
  use AppBundle\Controller\AbstractBaseController;
  use AppBundle\Form\IndexAdvantageType;
  use AppBundle\Entity\IndexAdvantage;
  use Symfony\Component\HttpFoundation\Response;
  use Symfony\Component\HttpFoundation\Request;
  use Symfony\Component\Routing\Annotation\Route;
  use Doctrine\ORM\EntityManagerInterface;
  
  
  class AdminIndexController extends AbstractBaseController
  {
      /**
       * @Route("/admin/")
       */
      public function IndexAction()
      {
          return $this-&gt;render('AppBundle:AdminIndex:index.html.twig', array());
      }
  ...&lt;&lt;&lt;&lt;SOME OTHER FUNCTIONS&gt;&gt;&gt;&gt;&gt;&gt;&gt;.....
      /**
       * @Route(
       *      "/advantage/new",
       *      name="admin.index_advantage.new",
       *      methods={"GET", "POST"}
       * )
       */
      public function newAdvantageAction(Request $request)
      {   
          $advantage = new IndexAdvantage();
          $form = $this-&gt;createForm('AppBundle\Form\IndexAdvantageType', $advantage);
          $form-&gt;handleRequest($request);
  
          if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
  
              $advantage = $form-&gt;getData();
              $em = $this-&gt;getDoctrine()-&gt;getManager();
              $em-&gt;persist($advantage);
              $em-&gt;flush($advantage);
          }
  
          return $this-&gt;render(
              'AppBundle:AdminIndexAdvantage:new.html.twig',['form' =&gt; $form-&gt;createView()]
          );
      }
  }
  </code></pre>
  
  <p><strong>My form twig</strong> <em>AppBundle\Resources\view\AdminIndexAdvantage\new.html.twig</em></p>
  
  <pre><code>{% extends 'adminLayout.html.twig' %}
  
  {% block content %}
      &lt;h1&gt;NEW&lt;/h1&gt;
      {{ form_start(form) }}
          {{ form_widget(form) }}
          &lt;input class="btn btn-success" type="submit" value="Create" /&gt;
      {{ form_end(form) }}
  {% endblock %}
  </code></pre>
  
  <p>I also manually created route to function <code>newAdvantageAction</code> at <code>var/cache/prod/appProdProjectContainerUrlGenerator.php</code> and <code>var/cache/prod/appProdProjectContainerUrlMatcher.php</code></p>
  
  <pre><code>        'admin.index_advantage.new' =&gt; array (0 =&gt; array (0 =&gt; 'id',),
    1 =&gt; array ('_controller' =&gt;'AppBundle\\Controller\\Admin\\AdminIndexController::newAdvantageAction',),
    2 =&gt; array (  ),
    3 =&gt; array (0 =&gt; array (0 =&gt; 'text', 1 =&gt; '/advantage/new',), 1 =&gt;array (0 =&gt; 'variable', 1 =&gt; '/', 2 =&gt; '[^/]++', 3 =&gt; 'id',), 2 =&gt; array ( 0 =&gt; 'text', 1 =&gt; '/admin/index',),), 4 =&gt; array (  ), 5 =&gt; array (  ),),
  </code></pre>
  
  <p>and</p>
  
  <pre><code>                // admin_index_advantage_new
                  if (0 === strpos($pathinfo, '/admin/index') &amp;&amp; preg_match('#^/admin/index/(?P&lt;id&gt;[^/]++)/advantage/new$#sD', $pathinfo, $matches)) {
                      $ret = $this-&gt;mergeDefaults(array_replace($matches, ['_route' =&gt; 'admin.index_advantage.new']), array (  '_controller' =&gt; 'AppBundle\\Controller\\Admin\\AdminIndexController::newAdvantageAction',));
                      if (!in_array($canonicalMethod, ['GET', 'POST'])) {
                          $allow = array_merge($allow, ['GET', 'POST']);
                          goto not_adminindex_advantagenew;
                      }
  
                      return $ret;
                  }
                  not_adminindex_advantagenew:
  </code></pre>