title: Symfony2.1 form date field: Argument 1 passed to ... must be an instance of DateTime
body: <p>My Entity:</p>
  
  <pre><code>/**
   * @var \DateTime $publishedAt
   *
   * @ORM\Column(name="published_at", type="date")
   * 
   * @Assert\Date()
   */
  private $publishedAt;
  
  /**
   * Set publishedAt
   *
   * @param \DateTime $publishedAt
   * @return MagazineIssue
   */
  public function setPublishedAt(\DateTime $publishedAt)
  {
      $this-&gt;publishedAt = $publishedAt;
  
      return $this;
  }
  
  /**
   * Get published_at
   *
   * @return \DateTime 
   */
  public function getPublishedAt()
  {
      return $this-&gt;publishedAt;
  }
  </code></pre>
  
  <p>My form builder:</p>
  
  <pre><code>$builder-&gt;add('publishedAt');
  </code></pre>
  
  <p>My view:</p>
  
  <pre><code>{{ form_widget(form) }}
  </code></pre>
  
  <p>When I select the date in the selects and submit the form I catche the error:</p>
  
  <pre><code>Catchable Fatal Error: Argument 1 passed to ... must be an instance of DateTime, 
  string given, called in .../vendor/symfony/symfony/src/Symfony/Component/Form
  /Util/PropertyPath.php on line 537 and defined in ... line 214 
  </code></pre>
  
  <p>Why it happens? If I replace the field setter with <code>public function setPublishedAt($publishedAt)</code> I got the error:</p>
  
  <pre><code>Fatal error: Call to a member function format() on a non-object 
  in .../vendor/doctrine/dbal/lib/Doctrine/DBAL/Types/DateType.php on line 44 
  </code></pre>
  
  <p>If I change the form builder to</p>
  
  <pre><code> $builder-&gt;add('publishedAt','date')
  </code></pre>
  
  <p>all works fine. Why it happens? Why symfony can't guess it and pass to field setter the proper date format (\DateTime instead of string)?</p>
  
  <p><strong>EDIT:</strong> if I remove the <code>@Assert\Date()</code> then all works fine too. I think it's a sf2.1 bug with guessing the date field type</p>