Skip to content

Remove faulty PHP code blocks #9554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions service_container/3.3-di-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,32 +87,6 @@ Symfony Standard Edition:
</services>
</container>

.. code-block:: php

// app/config/services.php
use Symfony\Component\DependencyInjection\Definition;

// To use as default template
$definition = new Definition();

$definition
->setAutowired(true)
->setAutoconfigured(true)
->setPublic(false)
;

$this->registerClasses($definition, 'AppBundle\\', '../../src/AppBundle/*', '../../src/AppBundle/{Entity,Repository}');

// Changes default config
$definition
->addTag('controller.service_arguments')
;

// $this is a reference to the current loader
$this->registerClasses($definition, 'AppBundle\\Controller\\', '../../src/AppBundle/Controller/*');

// add more services, or override services that need manual wiring

This small bit of configuration contains a paradigm shift of how services
are configured in Symfony.

Expand Down Expand Up @@ -160,22 +134,6 @@ thanks to the following config:
</services>
</container>

.. code-block:: php

// app/config/services.php
use Symfony\Component\DependencyInjection\Definition;

// To use as default template
$definition = new Definition();

$definition
->setAutowired(true)
->setAutoconfigured(true)
->setPublic(false)
;

$this->registerClasses($definition, 'AppBundle\\', '../../src/AppBundle/*', '../../src/AppBundle/{Entity,Repository}');

This means that every class in ``src/AppBundle/`` is *available* to be used as a
service. And thanks to the ``_defaults`` section at the top of the file, all of
these services are **autowired** and **private** (i.e. ``public: false``).
Expand Down Expand Up @@ -512,18 +470,6 @@ inherited from an abstract definition:
</services>
</container>

.. code-block:: php

// app/config/services.php
use AppBundle\Domain\LoaderInterface;

// ...

/* This method returns a child definition to define the default
configuration of the given class or interface */
$container->registerForAutoconfiguration(LoaderInterface::class)
->addTag('app.domain_loader');

What about Performance
----------------------

Expand Down