Skip to content

Commit

Permalink
Remove class parameters and deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu authored and jordisala1991 committed Jul 1, 2021
1 parent 199fd7a commit 27e98ed
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 60 deletions.
3 changes: 0 additions & 3 deletions src/Resources/config/doctrine_mongodb.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@
->set('sonata.admin.guesser.doctrine_mongodb_list', TypeGuesser::class)
->tag('sonata.admin.guesser.doctrine_mongodb_list')

->set('sonata.admin.guesser.doctrine_mongodb_list_filter', FilterTypeGuesser::class)
->deprecate('The "%service_id%" service is deprecated since sonata-project/doctrine-mongodb-admin-bundle 3.4 and will be removed in 4.0. Use "sonata.admin.guesser.doctrine_mongodb_datagrid" service instead.')

->set('sonata.admin.guesser.doctrine_mongodb_list_chain', TypeGuesserChain::class)
->args([
[
Expand Down
67 changes: 16 additions & 51 deletions src/Resources/config/doctrine_mongodb_filter_types.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,68 +23,33 @@
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->parameters()

->set('sonata.admin.odm.filter.type.boolean.class', BooleanFilter::class)

->set('sonata.admin.odm.filter.type.callback.class', CallbackFilter::class)

->set('sonata.admin.odm.filter.type.choice.class', ChoiceFilter::class)

->set('sonata.admin.odm.filter.type.model.class', ModelFilter::class)

->set('sonata.admin.odm.filter.type.string.class', StringFilter::class)

->set('sonata.admin.odm.filter.type.number.class', NumberFilter::class)

->set('sonata.admin.odm.filter.type.date.class', DateFilter::class)

->set('sonata.admin.odm.filter.type.datetime.class', DateTimeFilter::class);

// Use "service" function for creating references to services when dropping support for Symfony 4.4
// Use "param" function for creating references to parameters when dropping support for Symfony 5.1
$containerConfigurator->services()

->set('sonata.admin.odm.filter.type.boolean', '%sonata.admin.odm.filter.type.boolean.class%')
->tag('sonata.admin.filter.type', [
'alias' => 'doctrine_mongo_boolean',
])
->set('sonata.admin.odm.filter.type.boolean', BooleanFilter::class)
->tag('sonata.admin.filter.type')

->set('sonata.admin.odm.filter.type.callback', '%sonata.admin.odm.filter.type.callback.class%')
->tag('sonata.admin.filter.type', [
'alias' => 'doctrine_mongo_callback',
])
->set('sonata.admin.odm.filter.type.callback', CallbackFilter::class)
->tag('sonata.admin.filter.type')

->set('sonata.admin.odm.filter.type.choice', '%sonata.admin.odm.filter.type.choice.class%')
->tag('sonata.admin.filter.type', [
'alias' => 'doctrine_mongo_choice',
])
->set('sonata.admin.odm.filter.type.choice', ChoiceFilter::class)
->tag('sonata.admin.filter.type')

->set('sonata.admin.odm.filter.type.id', IdFilter::class)
->tag('sonata.admin.filter.type')

->set('sonata.admin.odm.filter.type.model', '%sonata.admin.odm.filter.type.model.class%')
->tag('sonata.admin.filter.type', [
'alias' => 'doctrine_mongo_model',
])
->set('sonata.admin.odm.filter.type.model', ModelFilter::class)
->tag('sonata.admin.filter.type')

->set('sonata.admin.odm.filter.type.string', '%sonata.admin.odm.filter.type.string.class%')
->tag('sonata.admin.filter.type', [
'alias' => 'doctrine_mongo_string',
])
->set('sonata.admin.odm.filter.type.string', StringFilter::class)
->tag('sonata.admin.filter.type')

->set('sonata.admin.odm.filter.type.number', '%sonata.admin.odm.filter.type.number.class%')
->tag('sonata.admin.filter.type', [
'alias' => 'doctrine_mongo_number',
])
->set('sonata.admin.odm.filter.type.number', NumberFilter::class)
->tag('sonata.admin.filter.type')

->set('sonata.admin.odm.filter.type.date', '%sonata.admin.odm.filter.type.date.class%')
->tag('sonata.admin.filter.type', [
'alias' => 'doctrine_mongo_date',
])
->set('sonata.admin.odm.filter.type.date', DateFilter::class)
->tag('sonata.admin.filter.type')

->set('sonata.admin.odm.filter.type.datetime', '%sonata.admin.odm.filter.type.datetime.class%')
->tag('sonata.admin.filter.type', [
'alias' => 'doctrine_mongo_datetime',
]);
->set('sonata.admin.odm.filter.type.datetime', DateTimeFilter::class)
->tag('sonata.admin.filter.type');
};
6 changes: 1 addition & 5 deletions src/Resources/config/security.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@
use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->parameters()

->set('sonata.admin.manipulator.acl.object.doctrine_mongodb.class', ObjectAclManipulator::class);

// Use "service" function for creating references to services when dropping support for Symfony 4.4
// Use "param" function for creating references to parameters when dropping support for Symfony 5.1
$containerConfigurator->services()

->set('sonata.admin.manipulator.acl.object.doctrine_mongodb', '%sonata.admin.manipulator.acl.object.doctrine_mongodb.class%')
->set('sonata.admin.manipulator.acl.object.doctrine_mongodb', ObjectAclManipulator::class)
->args([
new ReferenceConfigurator('doctrine_mongodb'),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function testEntityManagerSetFactory(): void
$this->assertContainerBuilderHasService('sonata.admin.builder.doctrine_mongodb_form');
$this->assertContainerBuilderHasService('sonata.admin.builder.doctrine_mongodb_list');
$this->assertContainerBuilderHasService('sonata.admin.guesser.doctrine_mongodb_list');
$this->assertContainerBuilderHasService('sonata.admin.guesser.doctrine_mongodb_list_filter');
$this->assertContainerBuilderHasService('sonata.admin.guesser.doctrine_mongodb_list_chain');
$this->assertContainerBuilderHasService('sonata.admin.builder.doctrine_mongodb_show');
$this->assertContainerBuilderHasService('sonata.admin.guesser.doctrine_mongodb_show');
Expand Down

0 comments on commit 27e98ed

Please sign in to comment.