From cbcbb43fa8da551599daaddae1363de27faf24c5 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Wed, 4 Apr 2018 20:00:23 +0200 Subject: [PATCH] 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. --- service_container/3.3-di-changes.rst | 54 ---------------------------- 1 file changed, 54 deletions(-) diff --git a/service_container/3.3-di-changes.rst b/service_container/3.3-di-changes.rst index 09c8ee3c26a..bad7ffe71f4 100644 --- a/service_container/3.3-di-changes.rst +++ b/service_container/3.3-di-changes.rst @@ -87,32 +87,6 @@ Symfony Standard Edition: - .. 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. @@ -160,22 +134,6 @@ thanks to the following config: - .. 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``). @@ -512,18 +470,6 @@ inherited from an abstract definition: - .. 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 ----------------------