Skip to content

Commit

Permalink
Merge pull request #3076 from stof/prepare_major_version
Browse files Browse the repository at this point in the history
Prepare the major version
  • Loading branch information
stof authored Jun 24, 2024
2 parents ae4ce46 + 5ead80e commit 289ce2d
Show file tree
Hide file tree
Showing 44 changed files with 44 additions and 334 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
"dev-master": "4.x-dev"
}
},
"autoload": {
Expand Down
44 changes: 3 additions & 41 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
<?php
// src/AppBundle/CouchDocument/User.php
namespace AppBundle\CouchDocument;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ODM\CouchDB\Mapping\Annotations as CouchDB;
/**
* @CouchDB\Document
*/
class User extends BaseUser
{
/**
* @CouchDB\Id
*/
protected $id;
public function __construct()
{
parent::__construct();
// your own logic
}
}
Step 4: Configure your application's security.yml
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -351,7 +313,7 @@ of datastore you are using.
# app/config/config.yml
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'custom'
db_driver: orm # other valid values are 'mongodb' and 'custom'
firewall_name: main
user_class: AppBundle\Entity\User
from_email:
Expand All @@ -362,7 +324,7 @@ of datastore you are using.
<!-- app/config/config.xml -->
<!-- other valid 'db-driver' values are 'mongodb', 'couchdb' and 'custom' -->
<!-- other valid 'db-driver' values are 'mongodb' and 'custom' -->
<fos_user:config
db-driver="orm"
firewall-name="main"
Expand All @@ -371,7 +333,7 @@ of datastore you are using.
Only four configuration's nodes are required to use the bundle:

* The type of datastore you are using (``orm``, ``mongodb``, ``couchdb`` or ``custom```).
* The type of datastore you are using (``orm``, ``mongodb`` or ``custom```).
* The firewall name which you configured in Step 4.
* The fully qualified class name (FQCN) of the ``User`` class which you created in Step 3.
* The default email address to use when the bundle send a registration confirmation to the user.
Expand Down
8 changes: 0 additions & 8 deletions docs/user_manager.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ of ``FOS\UserBundle\Doctrine\UserManager``.
If you configure the ``db_driver`` option to ``mongodb``, this service is an
instance of ``FOS\UserBundle\Doctrine\UserManager``.

If you configure the ``db_driver`` option to ``couchdb``, this service is an
instance of ``FOS\UserBundle\Doctrine\UserManager``.

Accessing the User Manager service
----------------------------------

Expand Down Expand Up @@ -148,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.
4 changes: 1 addition & 3 deletions src/Command/ActivateUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@
* @author Antoine Hérault <[email protected]>
*
* @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';
Expand Down
4 changes: 1 addition & 3 deletions src/Command/ChangePasswordCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 1 addition & 3 deletions src/Command/CreateUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
* @author Luis Cordova <[email protected]>
*
* @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';
Expand Down
4 changes: 1 addition & 3 deletions src/Command/DeactivateUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@
* @author Antoine Hérault <[email protected]>
*
* @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';
Expand Down
4 changes: 1 addition & 3 deletions src/Command/DemoteUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@
* @author Lenar Lõhmus <[email protected]>
*
* @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';
Expand Down
4 changes: 1 addition & 3 deletions src/Command/PromoteUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@
* @author Lenar Lõhmus <[email protected]>
*
* @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';
Expand Down
4 changes: 1 addition & 3 deletions src/Controller/ChangePasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@
*
* @author Thibault Duplessis <[email protected]>
* @author Christophe Coevoet <[email protected]>
*
* @final
*/
class ChangePasswordController extends AbstractController
final class ChangePasswordController extends AbstractController
{
private $eventDispatcher;
private $formFactory;
Expand Down
4 changes: 1 addition & 3 deletions src/Controller/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@
* Controller managing the user profile.
*
* @author Christophe Coevoet <[email protected]>
*
* @final
*/
class ProfileController extends AbstractController
final class ProfileController extends AbstractController
{
private $eventDispatcher;
private $formFactory;
Expand Down
4 changes: 1 addition & 3 deletions src/Controller/RegistrationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@
*
* @author Thibault Duplessis <[email protected]>
* @author Christophe Coevoet <[email protected]>
*
* @final
*/
class RegistrationController extends AbstractController
final class RegistrationController extends AbstractController
{
private $eventDispatcher;
private $formFactory;
Expand Down
4 changes: 1 addition & 3 deletions src/Controller/ResettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@
*
* @author Thibault Duplessis <[email protected]>
* @author Christophe Coevoet <[email protected]>
*
* @final
*/
class ResettingController extends AbstractController
final class ResettingController extends AbstractController
{
private $eventDispatcher;
private $formFactory;
Expand Down
4 changes: 1 addition & 3 deletions src/Controller/SecurityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
*
* @author Thibault Duplessis <[email protected]>
* @author Christophe Coevoet <[email protected]>
*
* @final
*/
class SecurityController extends AbstractController
final class SecurityController extends AbstractController
{
private $authenticationUtils;
private $tokenManager;
Expand Down
4 changes: 1 addition & 3 deletions src/DependencyInjection/Compiler/CheckForSessionPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
* @author Ryan Weaver <[email protected]>
*
* @internal
*
* @final
*/
class CheckForSessionPass implements CompilerPassInterface
final class CheckForSessionPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/DependencyInjection/Compiler/CheckForSwiftMailerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
* @author Ryan Weaver <[email protected]>
*
* @internal
*
* @final
*/
class CheckForSwiftMailerPass implements CompilerPassInterface
final class CheckForSwiftMailerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
* @author Vasily Khayrulin <[email protected]>
*
* @internal
*
* @final
*/
class InjectRememberMeServicesPass implements CompilerPassInterface
final class InjectRememberMeServicesPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/DependencyInjection/Compiler/InjectUserCheckerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
* @author Gocha Ossinkine <[email protected]>
*
* @internal
*
* @final
*/
class InjectUserCheckerPass implements CompilerPassInterface
final class InjectUserCheckerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/DependencyInjection/Compiler/ValidationPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
* @author Christophe Coevoet <[email protected]>
*
* @internal
*
* @final
*/
class ValidationPass implements CompilerPassInterface
final class ValidationPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
Expand Down
14 changes: 2 additions & 12 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@
* @author Christophe Coevoet <[email protected]>
*
* @internal
*
* @final
*/
class Configuration implements ConfigurationInterface
final class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('fos_user');
$rootNode = $treeBuilder->getRootNode();

$supportedDrivers = ['orm', 'mongodb', 'couchdb', 'custom'];
$supportedDrivers = ['orm', 'mongodb', 'custom'];

$rootNode
->children()
Expand All @@ -44,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()
Expand Down
16 changes: 3 additions & 13 deletions src/DependencyInjection/FOSUserExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@
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
*
* @final
*/
class FOSUserExtension extends Extension
final class FOSUserExtension extends Extension
{
/**
* @var array<string, array{registry: string, tag: string, listener_class?: string}>
* @var array<string, array{registry: string, tag: string}>
*/
private static $doctrineDrivers = [
'orm' => [
Expand All @@ -39,11 +37,6 @@ 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;
Expand Down Expand Up @@ -99,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']) {
Expand Down
Loading

0 comments on commit 289ce2d

Please sign in to comment.