title: Symfony4 : The annotation does not exist, or could not be auto-loaded (Symfony\Component\Validator\Constraints)
body: <p>I'm working on a Symfony4 application and I have this error :</p>
  <blockquote>
  <p>[Semantical Error] The annotation
  &quot;@Symfony\Component\Validator\Constraints\NotBlank&quot; in property
  App\Entity\Product::$brochure does not exist, or could not be
  auto-loaded.</p>
  </blockquote>
  <p>Here is the <code>Product</code>class:</p>
  <pre><code>namespace App\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use Symfony\Component\Validator\Constraints as Assert;
  
  /**
   * @ORM\Entity(repositoryClass=&quot;App\Repository\ProductRepository&quot;)
   */
  class Product
  {
      /**
       * @ORM\Id
       * @ORM\GeneratedValue
       * @ORM\Column(type=&quot;integer&quot;)
       */
      private $id;
  
      /**
       * @ORM\Column(type=&quot;string&quot;, length=100)
       */
      private $name;
      
      /**
       * @ORM\Column(type=&quot;decimal&quot;, scale=2, nullable=true)
       */
      private $price;
  
      /**
       * @ORM\Column(type=&quot;text&quot;)
       */
      private $description;
  
      /**
       * @ORM\Column(type=&quot;string&quot;)
       *
       * @Assert\NotBlank(message=&quot;Please, upload the product brochure as a PDF file.&quot;)
       * @Assert\File(mimeTypes={ &quot;application/pdf&quot; })
       */
      private $brochure;
      
      public function getBrochure()
      {
          return $this-&gt;brochure;
      }
  
      public function setBrochure($brochure)
      {
          $this-&gt;brochure = $brochure;
  
          return $this;
      }
  
      public function getId()
      {
          return $this-&gt;id;
      }
  
      public function getName()
      {
          return $this-&gt;name;
      }
  
      public function setName($name)
      {
          $this-&gt;name = $name;
      }
  
      // ... getters &amp; setters for price &amp; description
  
      public function setPrice($price)
      {
          $this-&gt;price = $price;
      }
  
      public function setDescription($description)
      {
          $this-&gt;description = $description;
      }
  }
  </code></pre>
  <p>The annotation <code>@Symfony\Component\Validator\Constraints\File</code> makes also an error.</p>
  <p>Maybe, I forgot to configure something in Symfony, I don't know.</p>
  <p>How do I solve the problem?</p>