Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Symfony 6.1 deprecations #7836

Merged
merged 2 commits into from
May 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 1 addition & 0 deletions tests/App/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ protected function configureContainer(ContainerBuilder $containerBuilder, Loader
'translator' => [
'default_path' => '%kernel.project_dir%/translations',
],
'http_method_override' => false,
];

// TODO: Remove else case when dropping support of Symfony < 5.3
Expand Down