Skip to content

Commit

Permalink
Remove deprecations using Symfony 6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed May 29, 2022
1 parent 0aa141c commit 283ade9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
9 changes: 4 additions & 5 deletions src/Command/ExplainAdminCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
*/
final class ExplainAdminCommand extends Command
{
protected static $defaultName = 'sonata:admin:explain';

private Pool $pool;

/**
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/Command/GenerateObjectAclCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
*/
final class GenerateObjectAclCommand extends QuestionableCommand
{
protected static $defaultName = 'sonata:admin:generate-object-acl';

private string $userModelClass = '';

private Pool $pool;
Expand Down Expand Up @@ -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 <comment>App\Model\User</comment>. If not set, it will be asked the first time an object owner is set.')
Expand Down
6 changes: 3 additions & 3 deletions src/Command/ListAdminCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
*/
final class ListAdminCommand extends Command
{
protected static $defaultName = 'sonata:admin:list';

private Pool $pool;

/**
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/Command/SetupAclCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
*/
final class SetupAclCommand extends Command
{
protected static $defaultName = 'sonata:admin:setup-acl';

private Pool $pool;

private AdminAclManipulatorInterface $aclManipulator;
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/config/commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down

0 comments on commit 283ade9

Please sign in to comment.