title: How to set a date in Doctrine 2?
body: <p>I have a field named "birthday" in doctrine entity.</p>
  
  <p>I would like to create an object to add to database using doctrine.</p>
  
  <p>Inside the controller :</p>
  
  <pre><code>$name = "John Alex";
  $birthday = "11-11-90";
  $student = new Student();
  $student-&gt;setName($name);
  $student-&gt;setBirthday(strtotime($birthday);
  ...
  </code></pre>
  
  <p>but when I try to persist I get this error</p>
  
  <pre><code>Fatal error: Call to a member function format() on a non-object in /Library/WebServer/Documents/Symfony/vendor/doctrine-dbal/lib/Doctrine/DBAL/Types/DateType.php on line 44
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>My entity:</p>
  
  <pre><code>/**
   * @var string $name
   *
   * @ORM\Column(name="name", type="string", length=255)
   */
  private $name;
  
  /**
   * @var date $birthday
   *
   * @ORM\Column(name="birthday", type="date", nullable=true)
   */
  private $birthday;
  
  /**
   * Set birthday
   *
   * @param date $birthday
   */
  public function setBirthday($birthday)
  {
      $this-&gt;birthday = $birthday;
  }
  
  /**
   * Get birthday
   *
   * @return date 
   */
  public function getBirthday()
  {
      return $this-&gt;birthday;
  }
  </code></pre>