@@ -87,32 +87,6 @@ Symfony Standard Edition:
87
87
</services >
88
88
</container >
89
89
90
- .. code-block :: php
91
-
92
- // app/config/services.php
93
- use Symfony\Component\DependencyInjection\Definition;
94
-
95
- // To use as default template
96
- $definition = new Definition();
97
-
98
- $definition
99
- ->setAutowired(true)
100
- ->setAutoconfigured(true)
101
- ->setPublic(false)
102
- ;
103
-
104
- $this->registerClasses($definition, 'AppBundle\\', '../../src/AppBundle/*', '../../src/AppBundle/{Entity,Repository}');
105
-
106
- // Changes default config
107
- $definition
108
- ->addTag('controller.service_arguments')
109
- ;
110
-
111
- // $this is a reference to the current loader
112
- $this->registerClasses($definition, 'AppBundle\\Controller\\', '../../src/AppBundle/Controller/*');
113
-
114
- // add more services, or override services that need manual wiring
115
-
116
90
This small bit of configuration contains a paradigm shift of how services
117
91
are configured in Symfony.
118
92
@@ -160,22 +134,6 @@ thanks to the following config:
160
134
</services >
161
135
</container >
162
136
163
- .. code-block :: php
164
-
165
- // app/config/services.php
166
- use Symfony\Component\DependencyInjection\Definition;
167
-
168
- // To use as default template
169
- $definition = new Definition();
170
-
171
- $definition
172
- ->setAutowired(true)
173
- ->setAutoconfigured(true)
174
- ->setPublic(false)
175
- ;
176
-
177
- $this->registerClasses($definition, 'AppBundle\\', '../../src/AppBundle/*', '../../src/AppBundle/{Entity,Repository}');
178
-
179
137
This means that every class in ``src/AppBundle/ `` is *available * to be used as a
180
138
service. And thanks to the ``_defaults `` section at the top of the file, all of
181
139
these services are **autowired ** and **private ** (i.e. ``public: false ``).
@@ -512,18 +470,6 @@ inherited from an abstract definition:
512
470
</services >
513
471
</container >
514
472
515
- .. code-block :: php
516
-
517
- // app/config/services.php
518
- use AppBundle\Domain\LoaderInterface;
519
-
520
- // ...
521
-
522
- /* This method returns a child definition to define the default
523
- configuration of the given class or interface */
524
- $container->registerForAutoconfiguration(LoaderInterface::class)
525
- ->addTag('app.domain_loader');
526
-
527
473
What about Performance
528
474
----------------------
529
475
0 commit comments