From 283ade92434a26a50b8c79edbd8c780771de68e5 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Sun, 29 May 2022 12:53:22 +0200 Subject: [PATCH] Remove deprecations using Symfony 6.1 --- src/Command/ExplainAdminCommand.php | 9 ++++----- src/Command/GenerateObjectAclCommand.php | 3 +-- src/Command/ListAdminCommand.php | 6 +++--- src/Command/SetupAclCommand.php | 6 +++--- src/Resources/config/commands.php | 8 ++++---- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/Command/ExplainAdminCommand.php b/src/Command/ExplainAdminCommand.php index 441712bf8e..5cd1b033d1 100644 --- a/src/Command/ExplainAdminCommand.php +++ b/src/Command/ExplainAdminCommand.php @@ -24,8 +24,6 @@ */ final class ExplainAdminCommand extends Command { - protected static $defaultName = 'sonata:admin:explain'; - private Pool $pool; /** @@ -40,9 +38,10 @@ public function __construct(Pool $pool) public function configure(): void { - $this->setDescription('Explain an admin service'); - - $this->addArgument('admin', InputArgument::REQUIRED, 'The admin service id'); + $this + ->setName('sonata:admin:explain') + ->setDescription('Explain an admin service') + ->addArgument('admin', InputArgument::REQUIRED, 'The admin service id'); } public function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Command/GenerateObjectAclCommand.php b/src/Command/GenerateObjectAclCommand.php index 52723ee999..c525d1fc73 100644 --- a/src/Command/GenerateObjectAclCommand.php +++ b/src/Command/GenerateObjectAclCommand.php @@ -26,8 +26,6 @@ */ final class GenerateObjectAclCommand extends QuestionableCommand { - protected static $defaultName = 'sonata:admin:generate-object-acl'; - private string $userModelClass = ''; private Pool $pool; @@ -55,6 +53,7 @@ public function __construct(Pool $pool, array $aclObjectManipulators) public function configure(): void { $this + ->setName('sonata:admin:generate-object-acl') ->setDescription('Install ACL for the objects of the Admin Classes.') ->addOption('object_owner', null, InputOption::VALUE_OPTIONAL, 'If set, the task will set the object owner for each admin.') ->addOption('user_model', null, InputOption::VALUE_OPTIONAL, 'Fully qualified class name App\Model\User. If not set, it will be asked the first time an object owner is set.') diff --git a/src/Command/ListAdminCommand.php b/src/Command/ListAdminCommand.php index f6c315ac43..df72b8830a 100644 --- a/src/Command/ListAdminCommand.php +++ b/src/Command/ListAdminCommand.php @@ -23,8 +23,6 @@ */ final class ListAdminCommand extends Command { - protected static $defaultName = 'sonata:admin:list'; - private Pool $pool; /** @@ -39,7 +37,9 @@ public function __construct(Pool $pool) public function configure(): void { - $this->setDescription('List all admin services available'); + $this + ->setName('sonata:admin:list') + ->setDescription('List all admin services available'); } public function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Command/SetupAclCommand.php b/src/Command/SetupAclCommand.php index c3e26452b3..6ff130bba0 100644 --- a/src/Command/SetupAclCommand.php +++ b/src/Command/SetupAclCommand.php @@ -24,8 +24,6 @@ */ final class SetupAclCommand extends Command { - protected static $defaultName = 'sonata:admin:setup-acl'; - private Pool $pool; private AdminAclManipulatorInterface $aclManipulator; @@ -43,7 +41,9 @@ public function __construct(Pool $pool, AdminAclManipulatorInterface $aclManipul public function configure(): void { - $this->setDescription('Install ACL for Admin Classes'); + $this + ->setName('sonata:admin:setup-acl') + ->setDescription('Install ACL for Admin Classes'); } public function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Resources/config/commands.php b/src/Resources/config/commands.php index bcb1425f05..e09553cd4b 100644 --- a/src/Resources/config/commands.php +++ b/src/Resources/config/commands.php @@ -24,26 +24,26 @@ $containerConfigurator->services() ->set('sonata.admin.command.explain', ExplainAdminCommand::class) - ->tag('console.command') + ->tag('console.command', ['command' => 'sonata:admin:explain']) ->args([ new ReferenceConfigurator('sonata.admin.pool'), ]) ->set('sonata.admin.command.generate_object_acl', GenerateObjectAclCommand::class) - ->tag('console.command') + ->tag('console.command', ['command' => 'sonata:admin:generate-object-acl']) ->args([ new ReferenceConfigurator('sonata.admin.pool'), [], ]) ->set('sonata.admin.command.list', ListAdminCommand::class) - ->tag('console.command') + ->tag('console.command', ['command' => 'sonata:admin:list']) ->args([ new ReferenceConfigurator('sonata.admin.pool'), ]) ->set('sonata.admin.command.setup_acl', SetupAclCommand::class) - ->tag('console.command') + ->tag('console.command', ['command' => 'sonata:admin:setup-acl']) ->args([ new ReferenceConfigurator('sonata.admin.pool'), new ReferenceConfigurator('sonata.admin.manipulator.acl.admin'),