Fatal error: Call to a member function format() on a non-object in /var/www/test/openmysfony/vendor/doctrine/dbal/lib/Doctrine/DBAL/Types/DateType.php on line 44
This problem is a bit strange.. Has anyone else encountered it? One is correct and the other is wrong in both the local environment and the server environment.
It is very typical that when instantiating an object, there is no check whether the instantiation is successful, and then the return value is directly called as an object. If there is no error, it is good luck, and if there is an error, it is better luck.
When saving time, you must first convert the passed in time into an object and then save it.
$now_time = new Datetime();
$product->setCreateTime($now_time);