title: Why do I receive "This value should be of type string" when using a DateTime constraint on Symfony 5?
body: <p>I have the following entity (only attached the relevant parts):</p>
  
  <pre class="lang-php prettyprint-override"><code>use ApiPlatform\Core\Annotation\ApiResource;
  use Doctrine\ORM\Mapping as ORM;
  use Symfony\Component\Validator\Constraints as Assert;
  
  /**
   * @ApiResource(mercure=true)
   * @ORM\Entity(repositoryClass="App\Repository\EventRepository")
   */
  class Event {
      /**
       * @ORM\Column(type="datetime")
       * @Assert\DateTime
       * @Assert\NotNull
       */
      private $createdAt;
  
      public function __construct() {
          $this-&gt;createdAt = new \DateTime();
      }
  
      public function getCreatedAt(): ?\DateTimeInterface {
          return $this-&gt;createdAt;
      }
  
      public function setCreatedAt(\DateTimeInterface $createdAt): self {
          $this-&gt;createdAt = $createdAt;
          return $this;
      }
  }
  </code></pre>
  
  <p>Its repository:</p>
  
  <pre><code>class EventRepository extends ServiceEntityRepository {
      public function __construct(ManagerRegistry $registry) {
          parent::__construct($registry, Event::class);
      }
  }
  </code></pre>
  
  <p>When creating a POST request to the event endpoint (via Postman or the Swagger UI), it fails with the following exception:</p>
  
  <p><a href="https://i.stack.imgur.com/hOKcS.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hOKcS.png" alt="profiler"></a></p>