diff --git a/CHANGELOG.md b/CHANGELOG.md index 86da005..a51b765 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file, in reverse ### Added -- Nothing. +- Using DoctrineObject hydrator instead of ClassMethods hydrator. ### Deprecated diff --git a/composer.json b/composer.json index b77ee0f..0914956 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ ], "require": { "php": ">=7.3", - "lm-commons/lmc-user": "~3.3", + "lm-commons/lmc-user": ">=3.3.3", "doctrine/doctrine-orm-module": "~3.0" }, "require-dev": { diff --git a/src/Module.php b/src/Module.php index 60f1b6e..40ca4e2 100644 --- a/src/Module.php +++ b/src/Module.php @@ -4,8 +4,10 @@ namespace LmcUserDoctrineORM; +use Doctrine\Laminas\Hydrator\DoctrineObject; use Doctrine\ORM\Mapping\Driver\XmlDriver; use Doctrine\ORM\EntityManager; +use DoctrineORMModule\Service\DoctrineObjectHydratorFactory; use LmcUserDoctrineORM\Mapper\User; /** @@ -40,12 +42,14 @@ public function getServiceConfig(): array return [ 'aliases' => [ 'lmcuser_doctrine_em' => EntityManager::class, + 'lmcuser_base_hydrator' => DoctrineObject::class ], 'factories' => [ 'lmcuser_module_options' => function ($sm) { $config = $sm->get('Configuration'); return new Options\ModuleOptions($config['lmcuser'] ?? []); }, + DoctrineObject::class => DoctrineObjectHydratorFactory::class, 'lmcuser_user_mapper' => function ($sm) { return new User( $sm->get('lmcuser_doctrine_em'),