Skip to content

Commit cbcbb43

Browse files
authored
Remove faulty PHP code blocks
The `_instanceof` and `_defaults` APIs have not equivalent for the low-level Definition API, as they are resource-scoped features and the low-level API does not have any concept of resource doing the definition.
1 parent 8c64e05 commit cbcbb43

File tree

1 file changed

+0
-54
lines changed

1 file changed

+0
-54
lines changed

Diff for: service_container/3.3-di-changes.rst

-54
Original file line numberDiff line numberDiff line change
@@ -87,32 +87,6 @@ Symfony Standard Edition:
8787
</services>
8888
</container>
8989
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-
11690
This small bit of configuration contains a paradigm shift of how services
11791
are configured in Symfony.
11892

@@ -160,22 +134,6 @@ thanks to the following config:
160134
</services>
161135
</container>
162136
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-
179137
This means that every class in ``src/AppBundle/`` is *available* to be used as a
180138
service. And thanks to the ``_defaults`` section at the top of the file, all of
181139
these services are **autowired** and **private** (i.e. ``public: false``).
@@ -512,18 +470,6 @@ inherited from an abstract definition:
512470
</services>
513471
</container>
514472
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-
527473
What about Performance
528474
----------------------
529475

0 commit comments

Comments
 (0)