title: Fatal error: Call to a member function format() on a non-object in Doctrine
body: <p>I am using <strong>date</strong> as a <strong>Data-Type</strong> in DOCTRINE , but its giving me this error:</p>
  
  <pre><code>Fatal error: Call to a member function format() on a non-object in C:\xampp\htdocs\test\doctrine\vendor\doctrine\dbal\lib\Doctrine\DBAL\Types\DateType.php on line 53
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code> /** 
   * private Date datePosted 
   * @Column(type="date")
   * @Assert\NotEmpty
   */
     private $datePosted ;
  </code></pre>
  
  <p>When i change type to string ,than it works fine. How can i fix this?</p>