Skip to content

Commit 1276f56

Browse files
committed
minor #7253 replace DefinitionDecorator with ChildDefinition (xabbuh)
This PR was merged into the master branch. Discussion ---------- replace DefinitionDecorator with ChildDefinition This fixes #7250. Commits ------- ab097ca replace DefinitionDecorator with ChildDefinition
2 parents 30bc8ed + ab097ca commit 1276f56

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

security/custom_authentication_provider.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ create a class which implements
315315
// src/AppBundle/DependencyInjection/Security/Factory/WsseFactory.php
316316
namespace AppBundle\DependencyInjection\Security\Factory;
317317
318+
use Symfony\Component\DependencyInjection\ChildDefinition;
318319
use Symfony\Component\DependencyInjection\ContainerBuilder;
319320
use Symfony\Component\DependencyInjection\Reference;
320-
use Symfony\Component\DependencyInjection\DefinitionDecorator;
321321
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
322322
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;
323323
@@ -327,12 +327,12 @@ create a class which implements
327327
{
328328
$providerId = 'security.authentication.provider.wsse.'.$id;
329329
$container
330-
->setDefinition($providerId, new DefinitionDecorator('wsse.security.authentication.provider'))
330+
->setDefinition($providerId, new ChildDefinition('wsse.security.authentication.provider'))
331331
->replaceArgument(0, new Reference($userProvider))
332332
;
333333
334334
$listenerId = 'security.authentication.listener.wsse.'.$id;
335-
$listener = $container->setDefinition($listenerId, new DefinitionDecorator('wsse.security.authentication.listener'));
335+
$listener = $container->setDefinition($listenerId, new ChildDefinition('wsse.security.authentication.listener'));
336336
337337
return array($providerId, $listenerId, $defaultEntryPoint);
338338
}
@@ -594,7 +594,7 @@ in order to put it to use.
594594
$providerId = 'security.authentication.provider.wsse.'.$id;
595595
$container
596596
->setDefinition($providerId,
597-
new DefinitionDecorator('wsse.security.authentication.provider'))
597+
new ChildDefinition('wsse.security.authentication.provider'))
598598
->replaceArgument(0, new Reference($userProvider))
599599
->replaceArgument(2, $config['lifetime']);
600600
// ...

service_container/parent_services.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ duplicated service definitions:
9494
9595
use AppBundle\Repository\DoctrineUserRepository;
9696
use AppBundle\Repository\DoctrinePostRepository;
97+
use Symfony\Component\DependencyInjection\ChildDefinition;
9798
use Symfony\Component\DependencyInjection\Reference;
98-
use Symfony\Component\DependencyInjection\DefinitionDecorator;
9999
100100
// as no class is configured, the parent service MUST be abstract
101101
$container->register('app.base_doctrine_repository')
@@ -104,12 +104,13 @@ duplicated service definitions:
104104
;
105105
106106
// extend the app.base_doctrine_repository service
107-
$definition = new DefinitionDecorator('app.base_doctrine_repository');
107+
$definition = new ChildDefinition('app.base_doctrine_repository');
108108
$definition->setClass(DoctrineUserRepository::class);
109109
$container->setDefinition('app.user_repository', $definition);
110110
111-
$definition = new DefinitionDecorator('app.base_doctrine_repository');
111+
$definition = new ChildDefinition('app.base_doctrine_repository');
112112
$definition->setClass(DoctrinePostRepository::class);
113+
113114
$container->setDefinition('app.post_repository', $definition);
114115
115116
// ...
@@ -201,19 +202,19 @@ in the child class:
201202
202203
use AppBundle\Repository\DoctrineUserRepository;
203204
use AppBundle\Repository\DoctrinePostRepository;
205+
use Symfony\Component\DependencyInjection\ChildDefinition;
204206
use Symfony\Component\DependencyInjection\Reference;
205-
use Symfony\Component\DependencyInjection\DefinitionDecorator;
206207
// ...
207208
208-
$definition = new DefinitionDecorator('app.base_doctrine_repository');
209+
$definition = new ChildDefinition('app.base_doctrine_repository');
209210
$definition->setClass(DoctrineUserRepository::class);
210211
// overrides the public setting of the parent service
211212
$definition->setPublic(false);
212213
// appends the '@app.username_checker' argument to the parent argument list
213214
$definition->addArgument(new Reference('app.username_checker'));
214215
$container->setDefinition('app.user_repository', $definition);
215216
216-
$definition = new DefinitionDecorator('app.base_doctrine_repository');
217+
$definition = new ChildDefinition('app.base_doctrine_repository');
217218
$definition->setClass(DoctrinePostRepository::class);
218219
// overrides the first argument
219220
$definition->replaceArgument(0, new Reference('doctrine.custom_entity_manager'));

0 commit comments

Comments
 (0)