Skip to content

Commit

Permalink
Merge pull request #2 from LM-Commons/DoctrineHydrator
Browse files Browse the repository at this point in the history
Using the doctrine object hydrator
  • Loading branch information
Al3x Zamponi authored Jan 21, 2021
2 parents 521b7d7 + 2a0db5d commit 4feb1aa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 4 additions & 0 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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'),
Expand Down

0 comments on commit 4feb1aa

Please sign in to comment.