title: Why symfony assert doesnt work with novalidation attribute on Edit Page?
body: <p>On my form, I am using <code>novalidate</code> attribute like this :</p>
  <pre><code>{{ form_start(form, {'attr': {novalidate: 'novalidate'}}) }}                
  </code></pre>
  <p>To disable HTML5 browser validation.
  So Symfony assert errors appears.
  On the new.html.twig page it works perfectly fine! The novalidate attribute disable the html5 validation and the assert errors appear.</p>
  <p>But when I use the novalidate attribute on edit.html.twig and leave the <code>username</code> field empty (i don't fill it on the form) the <code>@Assert\NotBlank()</code> doesn't work. And I get this error</p>
  <blockquote>
  <p>Expected argument of type &quot;string&quot;, &quot;null&quot; given at property path
  &quot;username&quot;.</p>
  </blockquote>
  <p>Why symfony assert work on the <strong>new</strong> page, but it doesnt work on the <strong>edit</strong> page?
  By the way, i am not using any validation groups.</p>
  <p>here is the code of my User entity(without getters and setters) :</p>
  <pre><code>class User implements UserInterface
  {
      /**
       * @ORM\Id()
       * @ORM\GeneratedValue()
       * @ORM\Column(type=&quot;integer&quot;)
       */
      private $id;
  
      /**
       * @ORM\Column(type=&quot;string&quot;, length=255)
       * @Assert\Email()
       * @Assert\NotBlank()
       */
      private $email;
  
      /**
       * @ORM\Column(type=&quot;string&quot;, length=255)
       * @Assert\NotBlank()
       */
      private $username;
  
      /**
       * @ORM\Column(type=&quot;string&quot;, length=255)
       * @Assert\NotBlank()
       * @Assert\Length(
       *      min = 8, max = 30,
       *      minMessage = &quot;Your password must be between 6 and 30 characters.&quot;)     
       */
      private $password;
      
      /**
       * @ORM\Column(type=&quot;json&quot;, nullable=true )
       */
      private $roles = [];
  </code></pre>
  <p>Here is the code of the form :</p>
  <pre><code>class UserType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add('email', EmailType::class )
              -&gt;add('username', TextType::class)
              -&gt;add('password',PasswordType::class)
          ;
      }
  
      public function configureOptions(OptionsResolver $resolver)
      {
          $resolver-&gt;setDefaults([
              'data_class' =&gt; User::class,
          ]);
      }
  }
  </code></pre>
  <p>both of new.html.twig and edit.html.twig have the same code :</p>
  <pre><code>{{ form_start(form, {'attr': {novalidate: 'novalidate'}}) }}    
  
      {{ form_widget(form.email, {'attr': {'class': 'form-control',placeholder: 'Email Adress'} }) }}     
      {{form_errors(form.email)}}
  
      {{ form_widget(form.username, {'attr': {'class': 'form-control',placeholder: 'Username'} }) }}
      {{form_errors(form.username)}}
  
      {{ form_widget(form.password, {'attr': {'class': 'form-control'} }) }}
      {{form_errors(form.password)}}
  
      &lt;button class=&quot;btn btn-success&quot;&gt;Submit&lt;/button&gt;
  {{ form_rest(form) }}
  {{ form_end(form) }}
  </code></pre>
  <p>Controller code :</p>
  <pre><code>/**
   * @Route(&quot;/new&quot;, name=&quot;user_new&quot;, methods={&quot;GET&quot;,&quot;POST&quot;})
   */
  public function new(Request $request): Response
  {
      $user = new User();
      $form = $this-&gt;createForm(UserType::class, $user);
      $form-&gt;handleRequest($request);
  
      if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
          $entityManager = $this-&gt;getDoctrine()-&gt;getManager();
          $entityManager-&gt;persist($user);
          $entityManager-&gt;flush();
  
          return $this-&gt;redirectToRoute('user_index');
      }
  
      return $this-&gt;render('user/new.html.twig', [
          'user' =&gt; $user,
          'form' =&gt; $form-&gt;createView(),
      ]);
  }
  
  
  /**
   * @Route(&quot;/{id}/edit&quot;, name=&quot;user_edit&quot;, methods={&quot;GET&quot;,&quot;POST&quot;})
   */
  public function edit(Request $request, User $user): Response
  {
      $form = $this-&gt;createForm(UserType::class, $user);
      $form-&gt;handleRequest($request);
  
      if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
          $this-&gt;getDoctrine()-&gt;getManager()-&gt;flush();
  
          return $this-&gt;redirectToRoute('user_index');
      }
  
      return $this-&gt;render('user/edit.html.twig', [
          'user' =&gt; $user,
          'form' =&gt; $form-&gt;createView(),
      ]);
  }
  </code></pre>
  <p>my getters and setters :</p>
  <pre><code>public function getEmail(): ?string
  {
      return $this-&gt;email;
  }
  
  public function setEmail(string $email): self
  {
      $this-&gt;email = $email;
  
      return $this;
  }
  public function getUsername(): ?string
  {
      return $this-&gt;username;
  }
  
  public function setUsername(string $username): self
  {
      $this-&gt;username = $username;
  
      return $this;
  }
  
  
  public function getPassword(): ?string
  {
      return $this-&gt;password;
  }
  
  public function setPassword(string $password): self
  {
      $this-&gt;password = $password;
  
      return $this;
  }
  </code></pre>