@@ -92,8 +92,8 @@ duplicated service definitions:
92
92
93
93
.. code-block :: php
94
94
95
+ use Symfony\Component\DependencyInjection\ChildDefinition;
95
96
use Symfony\Component\DependencyInjection\Reference;
96
- use Symfony\Component\DependencyInjection\DefinitionDecorator;
97
97
98
98
// as no class is configured, the parent service MUST be abstract
99
99
$container->register('app.base_doctrine_repository')
@@ -102,11 +102,11 @@ duplicated service definitions:
102
102
;
103
103
104
104
// extend the app.base_doctrine_repository service
105
- $definition = new DefinitionDecorator ('app.base_doctrine_repository');
105
+ $definition = new ChildDefinition ('app.base_doctrine_repository');
106
106
$definition->setClass('AppBundle\Repository\DoctrineUserRepository');
107
107
$container->setDefinition('app.user_repository', $definition);
108
108
109
- $definition = new DefinitionDecorator ('app.base_doctrine_repository');
109
+ $definition = new ChildDefinition ('app.base_doctrine_repository');
110
110
$definition->setClass('AppBundle\Repository\DoctrinePostRepository');
111
111
$container->setDefinition('app.post_repository', $definition);
112
112
@@ -197,19 +197,19 @@ in the child class:
197
197
198
198
.. code-block :: php
199
199
200
+ use Symfony\Component\DependencyInjection\ChildDefinition;
200
201
use Symfony\Component\DependencyInjection\Reference;
201
- use Symfony\Component\DependencyInjection\DefinitionDecorator;
202
202
// ...
203
203
204
- $definition = new DefinitionDecorator ('app.base_doctrine_repository');
204
+ $definition = new ChildDefinition ('app.base_doctrine_repository');
205
205
$definition->setClass('AppBundle\Repository\DoctrineUserRepository');
206
206
// overrides the public setting of the parent service
207
207
$definition->setPublic(false);
208
208
// appends the '@app.username_checker' argument to the parent argument list
209
209
$definition->addArgument(new Reference('app.username_checker'));
210
210
$container->setDefinition('app.user_repository', $definition);
211
211
212
- $definition = new DefinitionDecorator ('app.base_doctrine_repository');
212
+ $definition = new ChildDefinition ('app.base_doctrine_repository');
213
213
$definition->setClass('AppBundle\Repository\DoctrinePostRepository');
214
214
// overrides the first argument
215
215
$definition->replaceArgument(0, new Reference('doctrine.custom_entity_manager'));
0 commit comments