diff --git a/CHANGELOG.md b/CHANGELOG.md index e92b0c22..9d87e4a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,25 @@ Feature release (minor) - [745: Fix roles doctrine type mapping](https://github.com/nucleos/NucleosUserBundle/pull/745) thanks to @core23 +## 3.2.1 - 2024-02-07 + + +----- + +### Release Notes for [3.2.1](https://github.com/nucleos/NucleosUserBundle/milestone/34) + +3.2.x bugfix release (patch) + +### 3.2.1 + +- Total issues resolved: **0** +- Total pull requests resolved: **1** +- Total contributors: **1** + +#### Bug + +- [742: Fix doctrine listener registration](https://github.com/nucleos/NucleosUserBundle/pull/742) thanks to @core23 + ## 3.2.0 - 2024-02-04 diff --git a/src/DependencyInjection/NucleosUserExtension.php b/src/DependencyInjection/NucleosUserExtension.php index e44d674f..5ba91d00 100644 --- a/src/DependencyInjection/NucleosUserExtension.php +++ b/src/DependencyInjection/NucleosUserExtension.php @@ -13,6 +13,7 @@ namespace Nucleos\UserBundle\DependencyInjection; +use Doctrine\ORM\Events; use Nucleos\UserBundle\Mailer\ResettingMailer; use Nucleos\UserBundle\Model\GroupManager; use Nucleos\UserBundle\Model\UserManager; @@ -35,11 +36,19 @@ final class NucleosUserExtension extends Extension implements PrependExtensionIn private static array $doctrineDrivers = [ 'orm' => [ 'registry' => 'doctrine', - 'tag' => 'doctrine.event_subscriber', + 'tag' => 'doctrine.event_listener', + 'events' => [ + Events::prePersist, + Events::preUpdate, + ], ], 'mongodb' => [ 'registry' => 'doctrine_mongodb', - 'tag' => 'doctrine_mongodb.odm.event_subscriber', + 'tag' => 'doctrine_mongodb.odm.event_listener', + 'events' => [ + Events::prePersist, + Events::preUpdate, + ], ], ]; @@ -94,10 +103,13 @@ public function load(array $configs, ContainerBuilder $container): void if ($config['use_listener'] && isset(self::$doctrineDrivers[$config['db_driver']])) { $listenerDefinition = $container->getDefinition('nucleos_user.user_listener'); - $listenerDefinition->addTag(self::$doctrineDrivers[$config['db_driver']]['tag']); if (isset(self::$doctrineDrivers[$config['db_driver']]['listener_class'])) { $listenerDefinition->setClass(self::$doctrineDrivers[$config['db_driver']]['listener_class']); } + + foreach (self::$doctrineDrivers[$config['db_driver']]['events'] as $event) { + $listenerDefinition->addTag(self::$doctrineDrivers[$config['db_driver']]['tag'], ['event' => $event]); + } } $this->remapParametersNamespaces($config, $container, [