title: Symfony 5 controller won't validate errors
body: <p>I am trying to migrate a some parts of a project made with Typescript + Express + Firebase to Symfony 5 and MySQL. But I don't get why the <a href="https://symfony.com/doc/current/validation.html#using-the-validator-service" rel="nofollow noreferrer">ValidatorInterface</a> isn't working.</p>
  
  <p>When I submit the form with unexpected characters (i.e.: a password with 3 charactesrs) it creates the user despites the <a href="https://symfony.com/doc/current/reference/constraints.html" rel="nofollow noreferrer">validation constraints</a> assigned in the <code>User</code> entity. The only constraint validation that actually works despites it does not show any form errors, is the <a href="https://symfony.com/doc/current/reference/constraints/UniqueEntity.html" rel="nofollow noreferrer">UniqueEntity</a>.</p>
  
  <h3>This is how my controller looks like:</h3>
  
  <pre class="lang-php prettyprint-override"><code>    /**
       * GET: Display form
       * POST: Creates a user
       * 
       * @Route("/users/crear", name="create_user", methods={"GET", "POST"})
       */
      public function create_user(Request $request, EntityManagerInterface $entityManager, ValidatorInterface $validator)
      {
          $user = new User();
  
          // Form
          if ($request-&gt;isMethod('GET')) {
              $form = $this-&gt;createForm(CrearUserType::class, $user);
              return $this-&gt;render('user/create.html.twig', [
                  'form' =&gt; $form-&gt;createView(),
                  'errors' =&gt; []
              ]);
          }
  
          // Form submit
          $data = $request-&gt;request-&gt;get('create_user');
          $errors = [];
  
          $user-&gt;setName($data['name']);
          $user-&gt;setEmail($data['email']);
          $user-&gt;setPassword($data['password']);
          $user-&gt;setCreatedAt(new \DateTime());
          $user-&gt;setUpdatedAt(new \DateTime());
  
          $form = $this-&gt;createForm(CrearUserType::class, $user);
  
          // Entity validation
          $errors = $validator-&gt;validate($user);        
  
          if (count($errors) &gt; 0) { // This is always 0
              $user-&gt;setPassword('');
              return $this-&gt;render('user/create.html.twig', [
                  'form' =&gt; $form-&gt;createView(),
                  'user' =&gt; $user,
                  'errors' =&gt; $errors
              ]);
          }
  
          try {
              $user-&gt;setPassword(password_hash($user-&gt;getPassword(), PASSWORD_BCRYPT));
              $entityManager-&gt;persist($user);
              $entityManager-&gt;flush();
              $this-&gt;addFlash(
                  'success', 
                  'User '.$user-&gt;getName().' has been saved.'
              );
              return $this-&gt;redirectToRoute('users');
          } catch(\Exception $exception) {
              $user-&gt;setPassword('');
              $this-&gt;addFlash(
                  'error', 
                  'Server error: ' . $exception-&gt;getMessage()
              );
              return $this-&gt;render('user/create.html.twig', [
                  'form' =&gt; $form-&gt;createView(),
                  'user' =&gt; $user,
                  'errors' =&gt; $errors
              ]);
          }
      }
  </code></pre>
  
  <h3>And this is my entity:</h3>
  
  <pre class="lang-php prettyprint-override"><code>namespace App\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use Symfony\Component\Validator\Constraints as Assert;
  use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  
  /**
   * @ORM\Entity(repositoryClass="App\Repository\UserRepository")
   * @UniqueEntity("email")
   */
  class User
  {
      /**
       * @ORM\Id()
       * @ORM\GeneratedValue()
       * @ORM\Column(type="integer")
       */
      private $id;
  
      /**
       * @ORM\Column(type="string", length=255)
       * @Assert\NotBlank(message="Name is mandatory")
       */
      private $name;
  
      /**
       * @ORM\Column(type="string", length=255, unique=true)
       * @Assert\NotBlank(message="Email is mandatory")
       * @Assert\Email(
       *  message="Invalid email address"
       * )
       */
      private $email;
      /**
       * @ORM\Column(type="string", length=60)
       * @Assert\NotBlank(message="Password is mandatory")
       * @Assert\GreaterThanOrEqual(
       *  value=6,
       *  message="The password has to be at least 6 chars long"
       * )
       */
      private $password;
  
      /**
       * @ORM\Column(type="date")
       */
      private $createdAt;
  
      /**
       * @ORM\Column(type="date")
       */
      private $updatedAt;
  
      public function getId(): ?int
      {
          return $this-&gt;id;
      }
  
      public function getName(): ?string
      {
          return $this-&gt;name;
      }
  
      public function setName(string $name): self
      {
          $this-&gt;name = $name;
  
          return $this;
      }
  
      public function getEmail(): ?string
      {
          return $this-&gt;email;
      }
  
      public function setEmail(string $email): self
      {
          $this-&gt;email = $email;
  
          return $this;
      }
  
      public function getPassword(): ?string
      {
          return $this-&gt;password;
      }
  
      public function setPassword(?string $password): self
      {
          $this-&gt;password = $password;
  
          return $this;
      }
  
      public function getCreatedAt(): ?\DateTimeInterface
      {
          return $this-&gt;createdAt;
      }
  
      public function setCreatedAt(\DateTimeInterface $createdAt): self
      {
          $this-&gt;createdAt = $createdAt;
  
          return $this;
      }
  
      public function getUpdatedAt(): ?\DateTimeInterface
      {
          return $this-&gt;updatedAt;
      }
  
      public function setUpdatedAt(\DateTimeInterface $updatedAt): self
      {
          $this-&gt;updatedAt = $updatedAt;
  
          return $this;
      }
  }
  </code></pre>
  
  <p>So, any clues on what is wrong here?</p>