Doctrine 2: Call to a member function format() on a non-object … in DateTimeType.php

前端 未结 4 1789
北海茫月
北海茫月 2020-12-09 15:37

I have a DateTime field:

/**
 * Date time posted
 * @Column(type=\"datetime\")
 */
private $dtPosted;

which is set to a defau

4条回答
  •  情深已故
    2020-12-09 16:11

    you could always use:

    $this->updated = new \DateTime("now");
    

    http://www.doctrine-project.org/docs/orm/2.0/en/cookbook/working-with-datetime.html

提交回复
热议问题