title: Pass a timestamp to symfony form in a DataTime field
body: <p>I have an entity with a DateTime attribute : </p>
  
  <pre><code>/**
   * Poll
   *
   * @ORM\Table(name="poll")
   * @ORM\Entity(repositoryClass="Hubup\CoreBundle\Repository\PollRepository")
   */
  class Poll
  {
  
  
  /**
   * @var \DateTime
   *
   * @ORM\Column(name="expiration_date", type="datetime")
   *
   * @Groups({"basic"})
   * @Type("DateTime&lt;'U'&gt;")
   *
   */
      private $expirationDate;
  ...
  </code></pre>
  
  <p>With a corresponding form like this :</p>
  
  <pre><code>class PollType extends AbstractType
  {
      /**
       * @param FormBuilderInterface $builder
       * @param array $options
       */
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              ...
              -&gt;add('expirationDate', DateTimeType::class)
              ...
              ;
      }
  </code></pre>
  
  <p>I post a request with a json body : </p>
  
  <pre><code>{
      "expirationDate": 1549706072
  }
  </code></pre>
  
  <p>And I want my expirationDate to be mapped as a DateTime like a string date can be.</p>
  
  <p>I tried options like add <code>'input' =&gt; 'timestamp'</code> to the form (described <a href="https://stackoverflow.com/questions/32783152/symfony-form-datetime-to-return-unix-timestamp">here</a>) but I didn't find a way to make it work.</p>
  
  <p>When I have a case like this I usually get the data from the form and create the DateTime in the controller manually, but I think there is a better way to do it just with form.</p>
  
  <p>Hope I can find help.</p>