ZfcUserDoctrineORM\Mapper\User method update and insert incompatible with ZfcUser\Mapper\UserInterface
martin05 opened this issue · 2 comments
PHP Fatal error: Declaration of ZfcUserDoctrineORM\\Mapper\\User::update(ZfcUser\\Entity\\UserInterface $entity) must be compatible with ZfcUser\\Mapper\\User::update(ZfcUser\\Entity\\UserInterface $entity, $where = NULL, $tableName = NULL, ?Zend\\Hydrator\\HydratorInterface $hydrator = NULL)
and
Declaration of ZfcUser\\Mapper\\User::insert(ZfcUser\\Entity\\UserInterface $entity) should be compatible with ZfcUser\\Mapper\\AbstractDbMapper::insert(ZfcUser\\Entity\\UserInterface $entity, $tableName = NULL, ?Zend\\Hydrator\\HydratorInterface $hydrator = NULL)
tested with ZfcUserDoctrineORM 2.0.0 and ZfcUser 3.0.0 and PHP v7.2.7.
This issue is happening because you are using the master of ZfcUserDoctrineORM[1] and the branch <= 2º version [2]. To fix this:
1º Set your compose
"zf-commons/zfc-user": "1.*",
"zf-commons/zfc-user-doctrine-orm": "1.*",
2º Override user mapper
In function getServiceConfig of Module.php put
'zfcuser_user_mapper' => function ($sm) {
$mapper = new \Application\Mapper\User($sm->get('zfcuser_doctrine_em'), $sm->get('zfcuser_module_options'));
return $mapper;
},
And \Application\Mapper\User have to be "1.0 branch" one
I hope this help
[1]https://github.com/ZF-Commons/ZfcUserDoctrineORM/blob/master/src/ZfcUserDoctrineORM/Mapper/User.php
[2]https://github.com/ZF-Commons/ZfcUser/blob/2.x/src/ZfcUser/Mapper/User.php
Fixed in 2.0.1