Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge release 3.2.1 into 3.3.x #743

Merged
merged 3 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
18 changes: 15 additions & 3 deletions src/DependencyInjection/NucleosUserExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
],
],
];

Expand Down Expand Up @@ -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, [
Expand Down
Loading