From 11bc04ef87412def83db9e3a40ee1edbd1b5f6a5 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 24 Jun 2024 18:48:44 +0200 Subject: [PATCH 1/5] Update the branch alias to be 4.x-dev --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f7a71a6fb..7816ddb8c 100644 --- a/composer.json +++ b/composer.json @@ -62,7 +62,7 @@ }, "extra": { "branch-alias": { - "dev-master": "3.x-dev" + "dev-master": "4.x-dev" } }, "autoload": { From c7ae5342e0ffa57304a41bf572b6965cd73a4378 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 24 Jun 2024 18:54:39 +0200 Subject: [PATCH 2/5] Mark classes a final --- src/Command/ActivateUserCommand.php | 4 +--- src/Command/ChangePasswordCommand.php | 4 +--- src/Command/CreateUserCommand.php | 4 +--- src/Command/DeactivateUserCommand.php | 4 +--- src/Command/DemoteUserCommand.php | 4 +--- src/Command/PromoteUserCommand.php | 4 +--- src/Controller/ChangePasswordController.php | 4 +--- src/Controller/ProfileController.php | 4 +--- src/Controller/RegistrationController.php | 4 +--- src/Controller/ResettingController.php | 4 +--- src/Controller/SecurityController.php | 4 +--- src/DependencyInjection/Compiler/CheckForSessionPass.php | 4 +--- src/DependencyInjection/Compiler/CheckForSwiftMailerPass.php | 4 +--- .../Compiler/InjectRememberMeServicesPass.php | 4 +--- src/DependencyInjection/Compiler/InjectUserCheckerPass.php | 4 +--- src/DependencyInjection/Compiler/ValidationPass.php | 4 +--- src/DependencyInjection/Configuration.php | 4 +--- src/DependencyInjection/FOSUserExtension.php | 4 +--- src/Doctrine/UserListener.php | 4 +--- src/Event/FilterUserResponseEvent.php | 5 +---- src/Event/FormEvent.php | 5 +---- src/Event/GetResponseNullableUserEvent.php | 4 +--- src/Event/GetResponseUserEvent.php | 5 +---- src/EventListener/AuthenticationListener.php | 4 +--- src/EventListener/EmailConfirmationListener.php | 4 +--- src/EventListener/FlashListener.php | 4 +--- src/EventListener/LastLoginListener.php | 4 +--- src/EventListener/ResettingListener.php | 4 +--- src/FOSUserBundle.php | 4 +--- src/Form/DataTransformer/UserToUsernameTransformer.php | 4 +--- src/Form/Type/ChangePasswordFormType.php | 5 +---- src/Form/Type/ProfileFormType.php | 5 +---- src/Form/Type/RegistrationFormType.php | 5 +---- src/Form/Type/ResettingFormType.php | 5 +---- src/Form/Type/UsernameFormType.php | 4 +--- src/Mailer/NoopMailer.php | 4 +--- src/Validator/Initializer.php | 4 +--- 37 files changed, 37 insertions(+), 118 deletions(-) diff --git a/src/Command/ActivateUserCommand.php b/src/Command/ActivateUserCommand.php index 1c52fca40..7f81404ce 100644 --- a/src/Command/ActivateUserCommand.php +++ b/src/Command/ActivateUserCommand.php @@ -24,11 +24,9 @@ * @author Antoine Hérault * * @internal - * - * @final */ #[AsCommand(name: 'fos:user:activate', description: 'Activate a user')] -class ActivateUserCommand extends Command +final class ActivateUserCommand extends Command { // BC with Symfony <5.3 protected static $defaultName = 'fos:user:activate'; diff --git a/src/Command/ChangePasswordCommand.php b/src/Command/ChangePasswordCommand.php index 3f9f7e294..c6cd94781 100644 --- a/src/Command/ChangePasswordCommand.php +++ b/src/Command/ChangePasswordCommand.php @@ -22,11 +22,9 @@ /** * @internal - * - * @final */ #[AsCommand(name: 'fos:user:change-password', description: 'Change the password of a user.')] -class ChangePasswordCommand extends Command +final class ChangePasswordCommand extends Command { // BC with Symfony <5.3 protected static $defaultName = 'fos:user:change-password'; diff --git a/src/Command/CreateUserCommand.php b/src/Command/CreateUserCommand.php index 9c638695a..abba0d43d 100644 --- a/src/Command/CreateUserCommand.php +++ b/src/Command/CreateUserCommand.php @@ -27,11 +27,9 @@ * @author Luis Cordova * * @internal - * - * @final */ #[AsCommand(name: 'fos:user:create', description: 'Create a user.')] -class CreateUserCommand extends Command +final class CreateUserCommand extends Command { // BC with Symfony <5.3 protected static $defaultName = 'fos:user:create'; diff --git a/src/Command/DeactivateUserCommand.php b/src/Command/DeactivateUserCommand.php index d92b71a76..3b1ce69f6 100644 --- a/src/Command/DeactivateUserCommand.php +++ b/src/Command/DeactivateUserCommand.php @@ -24,11 +24,9 @@ * @author Antoine Hérault * * @internal - * - * @final */ #[AsCommand(name: 'fos:user:deactivate', description: 'Deactivate a user')] -class DeactivateUserCommand extends Command +final class DeactivateUserCommand extends Command { // BC with Symfony <5.3 protected static $defaultName = 'fos:user:deactivate'; diff --git a/src/Command/DemoteUserCommand.php b/src/Command/DemoteUserCommand.php index a875c01ce..9b4c130fe 100644 --- a/src/Command/DemoteUserCommand.php +++ b/src/Command/DemoteUserCommand.php @@ -20,11 +20,9 @@ * @author Lenar Lõhmus * * @internal - * - * @final */ #[AsCommand(name: 'fos:user:demote', description: 'Demote a user by removing a role')] -class DemoteUserCommand extends RoleCommand +final class DemoteUserCommand extends RoleCommand { // BC with Symfony <5.3 protected static $defaultName = 'fos:user:demote'; diff --git a/src/Command/PromoteUserCommand.php b/src/Command/PromoteUserCommand.php index c51850777..abfc3a804 100644 --- a/src/Command/PromoteUserCommand.php +++ b/src/Command/PromoteUserCommand.php @@ -22,11 +22,9 @@ * @author Lenar Lõhmus * * @internal - * - * @final */ #[AsCommand(name: 'fos:user:promote', description: 'Promotes a user by adding a role')] -class PromoteUserCommand extends RoleCommand +final class PromoteUserCommand extends RoleCommand { // BC with Symfony <5.3 protected static $defaultName = 'fos:user:promote'; diff --git a/src/Controller/ChangePasswordController.php b/src/Controller/ChangePasswordController.php index 1c64ca124..e3448efbe 100644 --- a/src/Controller/ChangePasswordController.php +++ b/src/Controller/ChangePasswordController.php @@ -31,10 +31,8 @@ * * @author Thibault Duplessis * @author Christophe Coevoet - * - * @final */ -class ChangePasswordController extends AbstractController +final class ChangePasswordController extends AbstractController { private $eventDispatcher; private $formFactory; diff --git a/src/Controller/ProfileController.php b/src/Controller/ProfileController.php index 10b232503..cc8b4d70c 100644 --- a/src/Controller/ProfileController.php +++ b/src/Controller/ProfileController.php @@ -30,10 +30,8 @@ * Controller managing the user profile. * * @author Christophe Coevoet - * - * @final */ -class ProfileController extends AbstractController +final class ProfileController extends AbstractController { private $eventDispatcher; private $formFactory; diff --git a/src/Controller/RegistrationController.php b/src/Controller/RegistrationController.php index 447d40864..9e9188fae 100644 --- a/src/Controller/RegistrationController.php +++ b/src/Controller/RegistrationController.php @@ -33,10 +33,8 @@ * * @author Thibault Duplessis * @author Christophe Coevoet - * - * @final */ -class RegistrationController extends AbstractController +final class RegistrationController extends AbstractController { private $eventDispatcher; private $formFactory; diff --git a/src/Controller/ResettingController.php b/src/Controller/ResettingController.php index a7f9539a5..367b58294 100644 --- a/src/Controller/ResettingController.php +++ b/src/Controller/ResettingController.php @@ -32,10 +32,8 @@ * * @author Thibault Duplessis * @author Christophe Coevoet - * - * @final */ -class ResettingController extends AbstractController +final class ResettingController extends AbstractController { private $eventDispatcher; private $formFactory; diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index 1e9ac832c..e0fda6a45 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -21,10 +21,8 @@ * * @author Thibault Duplessis * @author Christophe Coevoet - * - * @final */ -class SecurityController extends AbstractController +final class SecurityController extends AbstractController { private $authenticationUtils; private $tokenManager; diff --git a/src/DependencyInjection/Compiler/CheckForSessionPass.php b/src/DependencyInjection/Compiler/CheckForSessionPass.php index bf7ba9194..4a47917df 100644 --- a/src/DependencyInjection/Compiler/CheckForSessionPass.php +++ b/src/DependencyInjection/Compiler/CheckForSessionPass.php @@ -21,10 +21,8 @@ * @author Ryan Weaver * * @internal - * - * @final */ -class CheckForSessionPass implements CompilerPassInterface +final class CheckForSessionPass implements CompilerPassInterface { public function process(ContainerBuilder $container): void { diff --git a/src/DependencyInjection/Compiler/CheckForSwiftMailerPass.php b/src/DependencyInjection/Compiler/CheckForSwiftMailerPass.php index 5067066f2..ef34f1fb5 100644 --- a/src/DependencyInjection/Compiler/CheckForSwiftMailerPass.php +++ b/src/DependencyInjection/Compiler/CheckForSwiftMailerPass.php @@ -21,10 +21,8 @@ * @author Ryan Weaver * * @internal - * - * @final */ -class CheckForSwiftMailerPass implements CompilerPassInterface +final class CheckForSwiftMailerPass implements CompilerPassInterface { public function process(ContainerBuilder $container): void { diff --git a/src/DependencyInjection/Compiler/InjectRememberMeServicesPass.php b/src/DependencyInjection/Compiler/InjectRememberMeServicesPass.php index b108750b0..1d51ddc56 100644 --- a/src/DependencyInjection/Compiler/InjectRememberMeServicesPass.php +++ b/src/DependencyInjection/Compiler/InjectRememberMeServicesPass.php @@ -21,10 +21,8 @@ * @author Vasily Khayrulin * * @internal - * - * @final */ -class InjectRememberMeServicesPass implements CompilerPassInterface +final class InjectRememberMeServicesPass implements CompilerPassInterface { public function process(ContainerBuilder $container): void { diff --git a/src/DependencyInjection/Compiler/InjectUserCheckerPass.php b/src/DependencyInjection/Compiler/InjectUserCheckerPass.php index f0ef8dcdb..91e32c745 100644 --- a/src/DependencyInjection/Compiler/InjectUserCheckerPass.php +++ b/src/DependencyInjection/Compiler/InjectUserCheckerPass.php @@ -21,10 +21,8 @@ * @author Gocha Ossinkine * * @internal - * - * @final */ -class InjectUserCheckerPass implements CompilerPassInterface +final class InjectUserCheckerPass implements CompilerPassInterface { public function process(ContainerBuilder $container): void { diff --git a/src/DependencyInjection/Compiler/ValidationPass.php b/src/DependencyInjection/Compiler/ValidationPass.php index f77cc0163..17a27fd07 100644 --- a/src/DependencyInjection/Compiler/ValidationPass.php +++ b/src/DependencyInjection/Compiler/ValidationPass.php @@ -20,10 +20,8 @@ * @author Christophe Coevoet * * @internal - * - * @final */ -class ValidationPass implements CompilerPassInterface +final class ValidationPass implements CompilerPassInterface { public function process(ContainerBuilder $container): void { diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 2dbd8e6cc..030d9420d 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -25,10 +25,8 @@ * @author Christophe Coevoet * * @internal - * - * @final */ -class Configuration implements ConfigurationInterface +final class Configuration implements ConfigurationInterface { public function getConfigTreeBuilder(): TreeBuilder { diff --git a/src/DependencyInjection/FOSUserExtension.php b/src/DependencyInjection/FOSUserExtension.php index 2e8aaae58..cf0423636 100644 --- a/src/DependencyInjection/FOSUserExtension.php +++ b/src/DependencyInjection/FOSUserExtension.php @@ -22,10 +22,8 @@ /** * @internal - * - * @final */ -class FOSUserExtension extends Extension +final class FOSUserExtension extends Extension { /** * @var array diff --git a/src/Doctrine/UserListener.php b/src/Doctrine/UserListener.php index ee67118ff..900f2a497 100644 --- a/src/Doctrine/UserListener.php +++ b/src/Doctrine/UserListener.php @@ -27,10 +27,8 @@ * @author David Buchmann * * @internal - * - * @final */ -class UserListener implements EventSubscriber +final class UserListener implements EventSubscriber { private $passwordUpdater; private $canonicalFieldsUpdater; diff --git a/src/Event/FilterUserResponseEvent.php b/src/Event/FilterUserResponseEvent.php index 9687d9903..306c72190 100644 --- a/src/Event/FilterUserResponseEvent.php +++ b/src/Event/FilterUserResponseEvent.php @@ -15,10 +15,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -/** - * @final - */ -class FilterUserResponseEvent extends UserEvent +final class FilterUserResponseEvent extends UserEvent { private $response; diff --git a/src/Event/FormEvent.php b/src/Event/FormEvent.php index e58e170e8..c0dd0c858 100644 --- a/src/Event/FormEvent.php +++ b/src/Event/FormEvent.php @@ -16,10 +16,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Contracts\EventDispatcher\Event; -/** - * @final - */ -class FormEvent extends Event +final class FormEvent extends Event { /** * @var FormInterface diff --git a/src/Event/GetResponseNullableUserEvent.php b/src/Event/GetResponseNullableUserEvent.php index bed679706..a359e1848 100644 --- a/src/Event/GetResponseNullableUserEvent.php +++ b/src/Event/GetResponseNullableUserEvent.php @@ -20,10 +20,8 @@ * Response user event that allows null user. * * @author Konstantinos Christofilos - * - * @final */ -class GetResponseNullableUserEvent extends Event +final class GetResponseNullableUserEvent extends Event { /** * @var Request diff --git a/src/Event/GetResponseUserEvent.php b/src/Event/GetResponseUserEvent.php index b36cf61ee..af965a777 100644 --- a/src/Event/GetResponseUserEvent.php +++ b/src/Event/GetResponseUserEvent.php @@ -13,10 +13,7 @@ use Symfony\Component\HttpFoundation\Response; -/** - * @final - */ -class GetResponseUserEvent extends UserEvent +final class GetResponseUserEvent extends UserEvent { /** * @var Response|null diff --git a/src/EventListener/AuthenticationListener.php b/src/EventListener/AuthenticationListener.php index e008b5097..15f7efac2 100644 --- a/src/EventListener/AuthenticationListener.php +++ b/src/EventListener/AuthenticationListener.php @@ -22,10 +22,8 @@ /** * @internal - * - * @final */ -class AuthenticationListener implements EventSubscriberInterface +final class AuthenticationListener implements EventSubscriberInterface { /** * @var LoginManagerInterface diff --git a/src/EventListener/EmailConfirmationListener.php b/src/EventListener/EmailConfirmationListener.php index a2589a19b..9a3ed5e07 100644 --- a/src/EventListener/EmailConfirmationListener.php +++ b/src/EventListener/EmailConfirmationListener.php @@ -21,10 +21,8 @@ /** * @internal - * - * @final */ -class EmailConfirmationListener implements EventSubscriberInterface +final class EmailConfirmationListener implements EventSubscriberInterface { private $mailer; private $tokenGenerator; diff --git a/src/EventListener/FlashListener.php b/src/EventListener/FlashListener.php index f39c59fac..09facc324 100644 --- a/src/EventListener/FlashListener.php +++ b/src/EventListener/FlashListener.php @@ -20,10 +20,8 @@ /** * @internal - * - * @final */ -class FlashListener implements EventSubscriberInterface +final class FlashListener implements EventSubscriberInterface { /** * @var string[] diff --git a/src/EventListener/LastLoginListener.php b/src/EventListener/LastLoginListener.php index 687866a61..556de6d0e 100644 --- a/src/EventListener/LastLoginListener.php +++ b/src/EventListener/LastLoginListener.php @@ -21,10 +21,8 @@ /** * @internal - * - * @final */ -class LastLoginListener implements EventSubscriberInterface +final class LastLoginListener implements EventSubscriberInterface { /** * @var UserManagerInterface diff --git a/src/EventListener/ResettingListener.php b/src/EventListener/ResettingListener.php index 7d4efadcb..47960b075 100644 --- a/src/EventListener/ResettingListener.php +++ b/src/EventListener/ResettingListener.php @@ -20,10 +20,8 @@ /** * @internal - * - * @final */ -class ResettingListener implements EventSubscriberInterface +final class ResettingListener implements EventSubscriberInterface { /** * @var UrlGeneratorInterface diff --git a/src/FOSUserBundle.php b/src/FOSUserBundle.php index 75cf1aa97..956ff5fe6 100644 --- a/src/FOSUserBundle.php +++ b/src/FOSUserBundle.php @@ -26,10 +26,8 @@ /** * @author Matthieu Bontemps * @author Thibault Duplessis - * - * @final */ -class FOSUserBundle extends Bundle +final class FOSUserBundle extends Bundle { public function build(ContainerBuilder $container): void { diff --git a/src/Form/DataTransformer/UserToUsernameTransformer.php b/src/Form/DataTransformer/UserToUsernameTransformer.php index a196e02c8..72ef3a1df 100644 --- a/src/Form/DataTransformer/UserToUsernameTransformer.php +++ b/src/Form/DataTransformer/UserToUsernameTransformer.php @@ -22,10 +22,8 @@ * @author Thibault Duplessis * * @template-implements DataTransformerInterface - * - * @final */ -class UserToUsernameTransformer implements DataTransformerInterface +final class UserToUsernameTransformer implements DataTransformerInterface { /** * @var UserManagerInterface diff --git a/src/Form/Type/ChangePasswordFormType.php b/src/Form/Type/ChangePasswordFormType.php index bb31770ec..77ec5ed04 100644 --- a/src/Form/Type/ChangePasswordFormType.php +++ b/src/Form/Type/ChangePasswordFormType.php @@ -19,10 +19,7 @@ use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; use Symfony\Component\Validator\Constraints\NotBlank; -/** - * @final - */ -class ChangePasswordFormType extends AbstractType +final class ChangePasswordFormType extends AbstractType { /** * @var string diff --git a/src/Form/Type/ProfileFormType.php b/src/Form/Type/ProfileFormType.php index 78aeabafa..f672e4b09 100644 --- a/src/Form/Type/ProfileFormType.php +++ b/src/Form/Type/ProfileFormType.php @@ -19,10 +19,7 @@ use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; use Symfony\Component\Validator\Constraints\NotBlank; -/** - * @final - */ -class ProfileFormType extends AbstractType +final class ProfileFormType extends AbstractType { /** * @var string diff --git a/src/Form/Type/RegistrationFormType.php b/src/Form/Type/RegistrationFormType.php index f7cc8b70d..ee0ce0275 100644 --- a/src/Form/Type/RegistrationFormType.php +++ b/src/Form/Type/RegistrationFormType.php @@ -18,10 +18,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -/** - * @final - */ -class RegistrationFormType extends AbstractType +final class RegistrationFormType extends AbstractType { /** * @var string diff --git a/src/Form/Type/ResettingFormType.php b/src/Form/Type/ResettingFormType.php index aa4759057..01c037bab 100644 --- a/src/Form/Type/ResettingFormType.php +++ b/src/Form/Type/ResettingFormType.php @@ -17,10 +17,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -/** - * @final - */ -class ResettingFormType extends AbstractType +final class ResettingFormType extends AbstractType { /** * @var string diff --git a/src/Form/Type/UsernameFormType.php b/src/Form/Type/UsernameFormType.php index b60152c11..22505c6c8 100644 --- a/src/Form/Type/UsernameFormType.php +++ b/src/Form/Type/UsernameFormType.php @@ -20,10 +20,8 @@ * Form type for representing a UserInterface instance by its username string. * * @author Thibault Duplessis - * - * @final */ -class UsernameFormType extends AbstractType +final class UsernameFormType extends AbstractType { /** * @var UserToUsernameTransformer diff --git a/src/Mailer/NoopMailer.php b/src/Mailer/NoopMailer.php index 215cc8121..e240a5983 100644 --- a/src/Mailer/NoopMailer.php +++ b/src/Mailer/NoopMailer.php @@ -19,10 +19,8 @@ * and allows to use this bundle without swiftmailer. * * @author Thibault Duplessis - * - * @final */ -class NoopMailer implements MailerInterface +final class NoopMailer implements MailerInterface { /** * @return void diff --git a/src/Validator/Initializer.php b/src/Validator/Initializer.php index e181c0888..d2d6ce13a 100644 --- a/src/Validator/Initializer.php +++ b/src/Validator/Initializer.php @@ -21,10 +21,8 @@ * @author Christophe Coevoet * * @internal - * - * @final */ -class Initializer implements ObjectInitializerInterface +final class Initializer implements ObjectInitializerInterface { private $canonicalFieldsUpdater; From e2e866abc50875c794668833ae9fb209098b0867 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 24 Jun 2024 19:02:37 +0200 Subject: [PATCH 3/5] Remove the CouchDB integration --- docs/index.rst | 44 +----------- docs/user_manager.rst | 3 - src/DependencyInjection/Configuration.php | 10 +-- src/DependencyInjection/FOSUserExtension.php | 10 +-- src/Doctrine/CouchDB/UserListener.php | 71 ------------------- src/FOSUserBundle.php | 5 -- .../config/doctrine-mapping/User.couchdb.xml | 20 ------ .../config/storage-validation/couchdb.xml | 29 -------- .../FOSUserExtensionTest.php | 22 ------ 9 files changed, 5 insertions(+), 209 deletions(-) delete mode 100644 src/Doctrine/CouchDB/UserListener.php delete mode 100644 src/Resources/config/doctrine-mapping/User.couchdb.xml delete mode 100644 src/Resources/config/storage-validation/couchdb.xml diff --git a/docs/index.rst b/docs/index.rst index decbc9620..0e87bc83c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -216,44 +216,6 @@ this to start: } } -c) CouchDB User class -..................... - -.. note:: - Support for the CouchDB ODM is deprecated as the Doctrine CouchDB ODM is unmaintained. - -If you're persisting your users via the Doctrine CouchDB ODM, then your ``User`` -class should live in the ``CouchDocument`` namespace of your bundle and look -like this to start: - -.. code-block:: php - - - + getRootNode(); - $supportedDrivers = ['orm', 'mongodb', 'couchdb', 'custom']; + $supportedDrivers = ['orm', 'mongodb', 'custom']; $rootNode ->children() @@ -42,14 +42,6 @@ public function getConfigTreeBuilder(): TreeBuilder ->ifNotInArray($supportedDrivers) ->thenInvalid('The driver %s is not supported. Please choose one of '.json_encode($supportedDrivers)) ->end() - ->validate() - ->ifInArray(['couchdb']) - ->then(function ($v) { - trigger_deprecation('friendsofsymfony/user-bundle', '3.3.0', 'The CouchDB ODM integration is deprecated because the CouchDB ODM itself is unmaintained.'); - - return $v; - }) - ->end() ->cannotBeOverwritten() ->isRequired() ->cannotBeEmpty() diff --git a/src/DependencyInjection/FOSUserExtension.php b/src/DependencyInjection/FOSUserExtension.php index cf0423636..a7707b2e7 100644 --- a/src/DependencyInjection/FOSUserExtension.php +++ b/src/DependencyInjection/FOSUserExtension.php @@ -26,7 +26,7 @@ final class FOSUserExtension extends Extension { /** - * @var array + * @var array */ private static $doctrineDrivers = [ 'orm' => [ @@ -37,11 +37,6 @@ final class FOSUserExtension extends Extension 'registry' => 'doctrine_mongodb', 'tag' => 'doctrine_mongodb.odm.event_listener', ], - 'couchdb' => [ - 'registry' => 'doctrine_couchdb', - 'tag' => 'doctrine_couchdb.event_listener', - 'listener_class' => 'FOS\UserBundle\Doctrine\CouchDB\UserListener', - ], ]; private bool $mailerNeeded = false; @@ -97,9 +92,6 @@ public function load(array $configs, ContainerBuilder $container): void $listenerDefinition = $container->getDefinition('fos_user.user_listener'); $listenerDefinition->addTag(self::$doctrineDrivers[$config['db_driver']]['tag'], ['event' => 'prePersist']); $listenerDefinition->addTag(self::$doctrineDrivers[$config['db_driver']]['tag'], ['event' => 'preUpdate']); - if (isset(self::$doctrineDrivers[$config['db_driver']]['listener_class'])) { - $listenerDefinition->setClass(self::$doctrineDrivers[$config['db_driver']]['listener_class']); - } } if ($config['use_username_form_type']) { diff --git a/src/Doctrine/CouchDB/UserListener.php b/src/Doctrine/CouchDB/UserListener.php deleted file mode 100644 index 9d8c58624..000000000 --- a/src/Doctrine/CouchDB/UserListener.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace FOS\UserBundle\Doctrine\CouchDB; - -use Doctrine\Common\EventSubscriber; -use Doctrine\ODM\CouchDB\Event; -use Doctrine\ODM\CouchDB\Event\LifecycleEventArgs; -use FOS\UserBundle\Model\UserInterface; -use FOS\UserBundle\Util\CanonicalFieldsUpdater; -use FOS\UserBundle\Util\PasswordUpdaterInterface; - -/** - * @internal - * - * @final - * - * @deprecated The CouchDB ODM integration is deprecated since 3.3.0 because the CouchDB ODM itself is unmaintained. - */ -class UserListener implements EventSubscriber -{ - private $passwordUpdater; - private $canonicalFieldsUpdater; - - public function __construct(PasswordUpdaterInterface $passwordUpdater, CanonicalFieldsUpdater $canonicalFieldsUpdater) - { - $this->passwordUpdater = $passwordUpdater; - $this->canonicalFieldsUpdater = $canonicalFieldsUpdater; - } - - public function getSubscribedEvents(): array - { - return [ - Event::prePersist, - Event::preUpdate, - ]; - } - - public function prePersist(LifecycleEventArgs $args): void - { - $object = $args->getDocument(); - if ($object instanceof UserInterface) { - $this->updateUserFields($object); - } - } - - public function preUpdate(LifecycleEventArgs $args): void - { - $object = $args->getDocument(); - if ($object instanceof UserInterface) { - $this->updateUserFields($object); - } - } - - /** - * Updates the user properties. - */ - private function updateUserFields(UserInterface $user): void - { - $this->canonicalFieldsUpdater->updateCanonicalFields($user); - $this->passwordUpdater->hashPassword($user); - } -} diff --git a/src/FOSUserBundle.php b/src/FOSUserBundle.php index 956ff5fe6..d6860b824 100644 --- a/src/FOSUserBundle.php +++ b/src/FOSUserBundle.php @@ -11,7 +11,6 @@ namespace FOS\UserBundle; -use Doctrine\Bundle\CouchDBBundle\DependencyInjection\Compiler\DoctrineCouchDBMappingsPass; use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass; use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass; use FOS\UserBundle\DependencyInjection\Compiler\CheckForSessionPass; @@ -55,9 +54,5 @@ private function addRegisterMappingsPass(ContainerBuilder $container): void if (class_exists('Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass')) { $container->addCompilerPass(DoctrineMongoDBMappingsPass::createXmlMappingDriver($mappings, ['fos_user.model_manager_name'], 'fos_user.backend_type_mongodb')); } - - if (class_exists('Doctrine\Bundle\CouchDBBundle\DependencyInjection\Compiler\DoctrineCouchDBMappingsPass')) { - $container->addCompilerPass(DoctrineCouchDBMappingsPass::createXmlMappingDriver($mappings, ['fos_user.model_manager_name'], 'fos_user.backend_type_couchdb')); - } } } diff --git a/src/Resources/config/doctrine-mapping/User.couchdb.xml b/src/Resources/config/doctrine-mapping/User.couchdb.xml deleted file mode 100644 index 4a660da35..000000000 --- a/src/Resources/config/doctrine-mapping/User.couchdb.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Resources/config/storage-validation/couchdb.xml b/src/Resources/config/storage-validation/couchdb.xml deleted file mode 100644 index 66c006b98..000000000 --- a/src/Resources/config/storage-validation/couchdb.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/tests/DependencyInjection/FOSUserExtensionTest.php b/tests/DependencyInjection/FOSUserExtensionTest.php index fc8e8df3d..32803cb7a 100644 --- a/tests/DependencyInjection/FOSUserExtensionTest.php +++ b/tests/DependencyInjection/FOSUserExtensionTest.php @@ -373,28 +373,6 @@ public function userManagerSetFactoryProvider() ]; } - /** - * @group legacy - */ - public function testUserManagerSetFactoryCouchdb() - { - $this->configuration = new ContainerBuilder(); - $loader = new FOSUserExtension(); - $config = $this->getEmptyConfig(); - $config['db_driver'] = 'couchdb'; - $loader->load([$config], $this->configuration); - - $definition = $this->configuration->getDefinition('fos_user.object_manager'); - - $this->assertAlias('doctrine_couchdb', 'fos_user.doctrine_registry'); - - $factory = $definition->getFactory(); - - $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $factory[0]); - $this->assertSame('fos_user.doctrine_registry', (string) $factory[0]); - $this->assertSame('getManager', $factory[1]); - } - protected function createEmptyConfiguration() { $this->configuration = new ContainerBuilder(); From e5a163462025a492f1d4eaec80b868e5c1825a6f Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 24 Jun 2024 19:04:03 +0200 Subject: [PATCH 4/5] Remove outdated mention of a deprecated feature from the docs --- docs/user_manager.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/user_manager.rst b/docs/user_manager.rst index 4b25dd188..1bc6d3dc0 100644 --- a/docs/user_manager.rst +++ b/docs/user_manager.rst @@ -145,8 +145,3 @@ SecurityBundle integration The bundle provides several implementation of ``Symfony\Component\Security\Core\UserProviderInterface`` on top of the ``UserManagerInterface``. - -Although the built-in user managers also implement -``Symfony\Component\Security\Core\User\UserProviderInterface``, using the -UserManager as user provider is deprecated and will tbe removed in future -versions. Use ``FOS\UserBundle\Security\UserProvider`` instead. From 5ead80e5c688be075ab9b7fd6757a55eef30e3ff Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 24 Jun 2024 19:06:27 +0200 Subject: [PATCH 5/5] Change the base class of the DI extension --- src/DependencyInjection/FOSUserExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DependencyInjection/FOSUserExtension.php b/src/DependencyInjection/FOSUserExtension.php index a7707b2e7..56cceb97d 100644 --- a/src/DependencyInjection/FOSUserExtension.php +++ b/src/DependencyInjection/FOSUserExtension.php @@ -16,9 +16,9 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; /** * @internal