title: Update data with Symfony 3
body: <p>I have simple edit form where the user will have to fill up required fields. The problem is the validation of required fields doesn't show, and also the fields or data don't change.</p>
  
  <p><strong>UPDATE</strong> I var_dump the <code>$form-&gt;isSubmitted()</code> and it shows <code>bool(false)</code></p>
  
  <p>Here's my controller: </p>
  
  <pre><code>public function editAction(Request $request, $id) {
  
      $company = $this-&gt;getDoctrine()
          -&gt;getRepository('SwipeBundle:Company')
          -&gt;find($id);
  
      if(!$company) {
          throw $this-&gt;createNotFoundException(
              'No Company found for id '.$id
          );
      }
  
      $form = $this-&gt;createForm(CompanyType::class, $company, array(
          'action'=&gt;$this-&gt;generateUrl('swipe_backend_company_edit', array('id'=&gt;$company-&gt;getId())),
          'method'=&gt;'PUT'
      ));     
  
      if ($request-&gt;getMethod() == "POST") {
  
              if ($form-&gt;isSubmitted()) {
  
                  // $em-&gt;persist($company);
                  // $em-&gt;flush();
                  echo "Update";
              }
          }   
  
  
      return $this-&gt;render('Backend/Company/edit.html.twig', array(
          'form'=&gt;$form-&gt;createView(),
          'company'=&gt;$company
      ));
  }
  </code></pre>
  
  <p>And here's my twig template:</p>
  
  <pre><code>{% extends '::Backend/base.html.twig' %}
  {% block body %}
  
      &lt;!-- Section --&gt;
      &lt;section class="sections"&gt;  
  
          &lt;!-- Side Bar --&gt;
          {% include '::Backend/side_menu_bar.html.twig' %}
  
          &lt;!-- Wrapper --&gt;
          &lt;div id="administrator" class="wrapper"&gt; 
  
              &lt;div class="mt40 pt30"&gt; &lt;!-- Container --&gt;
                  &lt;h1 class="mb10 bold"&gt;Edit Company&lt;/h1&gt;
                  &lt;p class="mb30"&gt;Fill up all the required fields for Company.&lt;/p&gt;
  
                  {% if not form.vars.valid %}
                      &lt;p class="alert note-error"&gt;
                         There are errors in your form. Please check the fields marked in red.
                      &lt;/p&gt;
                  {% endif %}
  
                  &lt;div class="alert note-error"&gt;
                      &lt;p&gt;Fields with asterisk (*) are required&lt;/p&gt;
                  &lt;/div&gt;
  
                  {% set url = path('swipe_backend_company_edit', { 'id': company.id }) %}
  
                  &lt;form novalidate method="post" action="{{ url }}" class="p20 card mb30"&gt;
  
                      &lt;div class="sections pb30 pt10"&gt;
                          &lt;fieldset class="col span6"&gt;                    
                              {% set attr = {} %}
                              {% if form_errors(form.name) is not empty %}
                                  {% set attr = attr|merge({ 'class': 'alert error'}) %}
                              {% endif %}
                              &lt;label for="" class="input-required"&gt;
                                  &lt;strong&gt;Company Name&lt;span class="highlight-red"&gt;*&lt;/span&gt;
                                  &lt;/strong&gt;
                              &lt;/label&gt;
                              {{ form_widget(form.name, { 'attr': attr } ) }}
                              {% if not form.name.vars.valid %}
                              &lt;p class="mt10" style="color: #DC2B1B;"&gt;
                                  {{ form.name.vars.errors[0].message }}
                              &lt;/p&gt;
                              {% endif %}
                          &lt;/fieldset&gt;
  
                          &lt;fieldset class="col span6"&gt;
                              &lt;strong&gt;
                                  {{ form_label(form.website) }}
                              &lt;/strong&gt;
                               {{ form_widget(form.website) }}
                          &lt;/fieldset&gt;
                      &lt;/div&gt;
  
                      &lt;div class="sections pb30 pt10"&gt;
                          {% set attr = {} %}
                          {% if form_errors(form.email_address) is not empty %}
                              {% set attr = attr|merge({ 'class': 'alert error'}) %}
                          {% endif %}
                          &lt;label for="" class="input-required"&gt;
                              &lt;strong&gt;Company Email Address&lt;span class="highlight-red"&gt;*&lt;/span&gt;
                              &lt;/strong&gt;
                          &lt;/label&gt;
                          {{ form_widget(form.email_address, { 'attr': attr } ) }}
                          {% if not form.email_address.vars.valid %}
                          &lt;p class="mt10" style="color: #DC2B1B;"&gt;
                              {{ form.email_address.vars.errors[0].message }}
                          &lt;/p&gt;
                          {% endif %}
                      &lt;/div&gt;
  
                      &lt;div class="sections pb30 pt10"&gt;
                          &lt;fieldset class="col span6"&gt;
                              &lt;strong&gt;
                                  {{ form_label(form.telephone_no) }}
                              &lt;/strong&gt;
                               {{ form_widget(form.telephone_no) }}
                          &lt;/fieldset&gt;
  
                          &lt;fieldset class="col span6"&gt;
                              &lt;strong&gt;
                                  {{ form_label(form.mobile_no) }}
                              &lt;/strong&gt;
                               {{ form_widget(form.mobile_no) }}
                          &lt;/fieldset&gt;
                      &lt;/div&gt;
  
                      &lt;div class="sections pb30 pt10"&gt;
                          {% set attr = {} %}
                          {% if form_errors(form.address) is not empty %}
                              {% set attr = attr|merge({ 'class': 'alert error'}) %}
                          {% endif %}
                          &lt;label for="" class="input-required"&gt;
                              &lt;strong&gt;Company Address&lt;span class="highlight-red"&gt;*&lt;/span&gt;
                              &lt;/strong&gt;
                          &lt;/label&gt;
                          {{ form_widget(form.address, { 'attr': attr } ) }}
                          {% if not form.address.vars.valid %}
                          &lt;p class="mt10" style="color: #DC2B1B;"&gt;
                              {{ form.address.vars.errors[0].message }}
                          &lt;/p&gt;
                          {% endif %}
                      &lt;/div&gt;
  
                      &lt;div class="text-right mt20 mb10"&gt;
                          &lt;button class="btn btn-positive mt10 mr5"&gt;Update Company&lt;/button&gt;
                          &lt;button class="btn btn-positive mt10 mr5"&gt;Cancel&lt;/button&gt;
                      &lt;/div&gt;                  
  
                      {{ form_rest(form) }}
                  &lt;/form&gt;
  
              &lt;/div&gt; &lt;!-- Container End --&gt;
  
          &lt;/div&gt; &lt;!-- Wrapper End --&gt;
  
      &lt;/section&gt; &lt;!-- Section End --&gt;
  
  {% endblock %}
  </code></pre>