Update to FOSUserBundle 3.1

Also remove some deprecation from Symfony.
Use `LegacyEventDispatcherProxy` to handle Symfony 4 dispatch from FOSUser
This commit is contained in:
Jeremy Benoist
2022-12-13 13:39:24 +01:00
parent 141d289ec0
commit 33267f0736
30 changed files with 90 additions and 92 deletions

View File

@ -11,6 +11,7 @@ use Pagerfanta\Pagerfanta;
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@ -49,7 +50,7 @@ class ManageController extends Controller
// dispatch a created event so the associated config will be created
$event = new UserEvent($user, $request);
$this->get(EventDispatcherInterface::class)->dispatch(FOSUserEvents::USER_CREATED, $event);
LegacyEventDispatcherProxy::decorate($this->get(EventDispatcherInterface::class))->dispatch($event, FOSUserEvents::USER_CREATED);
$this->get(SessionInterface::class)->getFlashBag()->add(
'notice',

View File

@ -9,9 +9,6 @@ class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('wallabag_user');
return $treeBuilder;
return new TreeBuilder('wallabag_user');
}
}

View File

@ -12,7 +12,6 @@ use Scheb\TwoFactorBundle\Model\BackupCodeInterface;
use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface as EmailTwoFactorInterface;
use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface as GoogleTwoFactorInterface;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\UserInterface;
use Wallabag\ApiBundle\Entity\Client;
use Wallabag\CoreBundle\Entity\Config;
use Wallabag\CoreBundle\Entity\Entry;
@ -205,11 +204,6 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
return $this->entries;
}
public function isEqualTo(UserInterface $user)
{
return $this->username === $user->getUsername();
}
/**
* Set config.
*