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

前端 未结 4 1792
北海茫月
北海茫月 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:36

    The date() function returns a string. The datetime type works with DateTime objects. So either change the mapping type to string or use DateTime objects.

提交回复
热议问题