Skip to content

Commit ab4c278

Browse files
committed
replace DefinitionDecorator with ChildDefinition
1 parent 5b619c9 commit ab4c278

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-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
}
@@ -598,7 +598,7 @@ in order to put it to use.
598598
$providerId = 'security.authentication.provider.wsse.'.$id;
599599
$container
600600
->setDefinition($providerId,
601-
new DefinitionDecorator('wsse.security.authentication.provider'))
601+
new ChildDefinition('wsse.security.authentication.provider'))
602602
->replaceArgument(0, new Reference($userProvider))
603603
->replaceArgument(2, $config['lifetime']);
604604
// ...

service_container/parent_services.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ duplicated service definitions:
9292
9393
.. code-block:: php
9494
95+
use Symfony\Component\DependencyInjection\ChildDefinition;
9596
use Symfony\Component\DependencyInjection\Reference;
96-
use Symfony\Component\DependencyInjection\DefinitionDecorator;
9797
9898
// as no class is configured, the parent service MUST be abstract
9999
$container->register('app.base_doctrine_repository')
@@ -102,11 +102,11 @@ duplicated service definitions:
102102
;
103103
104104
// extend the app.base_doctrine_repository service
105-
$definition = new DefinitionDecorator('app.base_doctrine_repository');
105+
$definition = new ChildDefinition('app.base_doctrine_repository');
106106
$definition->setClass('AppBundle\Repository\DoctrineUserRepository');
107107
$container->setDefinition('app.user_repository', $definition);
108108
109-
$definition = new DefinitionDecorator('app.base_doctrine_repository');
109+
$definition = new ChildDefinition('app.base_doctrine_repository');
110110
$definition->setClass('AppBundle\Repository\DoctrinePostRepository');
111111
$container->setDefinition('app.post_repository', $definition);
112112
@@ -197,19 +197,19 @@ in the child class:
197197
198198
.. code-block:: php
199199
200+
use Symfony\Component\DependencyInjection\ChildDefinition;
200201
use Symfony\Component\DependencyInjection\Reference;
201-
use Symfony\Component\DependencyInjection\DefinitionDecorator;
202202
// ...
203203
204-
$definition = new DefinitionDecorator('app.base_doctrine_repository');
204+
$definition = new ChildDefinition('app.base_doctrine_repository');
205205
$definition->setClass('AppBundle\Repository\DoctrineUserRepository');
206206
// overrides the public setting of the parent service
207207
$definition->setPublic(false);
208208
// appends the '@app.username_checker' argument to the parent argument list
209209
$definition->addArgument(new Reference('app.username_checker'));
210210
$container->setDefinition('app.user_repository', $definition);
211211
212-
$definition = new DefinitionDecorator('app.base_doctrine_repository');
212+
$definition = new ChildDefinition('app.base_doctrine_repository');
213213
$definition->setClass('AppBundle\Repository\DoctrinePostRepository');
214214
// overrides the first argument
215215
$definition->replaceArgument(0, new Reference('doctrine.custom_entity_manager'));

0 commit comments

Comments
 (0)