FriendsOfSymfony / FOSUserBundle

Provides user management for your Symfony project. Compatible with Doctrine ORM & ODM, and custom storages.

Home Page:https://symfony.com/doc/master/bundles/FOSUserBundle/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not convert PHP value of type 'DateTime' to type 'datetime_immutable'

messkan opened this issue · comments

Hey, so i'm using symfony 3.4 , php 7.1.3 , whith oracle 18c xe database.

i'm using an oracle database, i added the bundle https://github.com/VasekPurchart/Doctrine-Date-Time-Immutable-Types-Bundle. But my main problem is, when i submit a new register form, i get this error :

Could not convert PHP value of type 'DateTime' to type 'datetime_immutable'. Expected one of the following types: null, DateTimeImmutable
Exception.

It seems because that fosuserbundle are using \DateTime, for example :

public function setLastLogin(\DateTime $time = null)
{
return parent::setLastLogin($time); // TODO: Change the autogenerated stub
}

and the php could not convert datetime to datetime_immutable.

the field in the bundle is mapped as a DBAL datetime type, not datetime_immutable.