From 4e796285c04ae7ef77e05caa02099a300e344c49 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 29 Nov 2017 17:18:18 +0100 Subject: [PATCH] Hopefully improve comments in services.yaml --- .../framework-bundle/3.3/config/services.yaml | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/symfony/framework-bundle/3.3/config/services.yaml b/symfony/framework-bundle/3.3/config/services.yaml index 77e8d51f..23800b49 100644 --- a/symfony/framework-bundle/3.3/config/services.yaml +++ b/symfony/framework-bundle/3.3/config/services.yaml @@ -5,24 +5,23 @@ parameters: services: # default configuration for services in *this* file _defaults: - # automatically injects dependencies in your services - autowire: true - # automatically registers your services as commands, event subscribers, etc. - autoconfigure: true - # this means you cannot fetch services directly from the container via $container->get() - # if you need to do this, you can override this setting on individual services - public: false + autowire: true # Automatically injects dependencies in your services. + autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. + public: false # Allows optimizing the container by removing unused services; this also means + # fetching services directly from the container via $container->get() won't work. + # The best practice is to be explicit about your dependencies anyway. # makes classes in src/ available to be used as services # this creates a service per class whose id is the fully-qualified class name App\: resource: '../src/*' - # you can exclude directories or files - # but if a service is unused, it's removed anyway - exclude: '../src/{DataFixtures,Entity,Migrations,Tests}' + exclude: '../src/{Entity,Migrations,Tests}' - # controllers are imported separately to make sure they - # have the tag that allows actions to type-hint services + # controllers are imported separately to make sure services can be injected + # as action arguments even if you don't extend any base controller class App\Controller\: resource: '../src/Controller' tags: ['controller.service_arguments'] + + # add more service definitions when explicit configuration is needed + # please note that last definitions always *replace* previous ones