Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Commit 663fc68

Browse files
committed
Making *all* services in src/AppBundle available as services
1 parent e44c4b1 commit 663fc68

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

app/config/services.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,28 @@ services:
88
_defaults:
99
# automatically injects dependencies in your services
1010
autowire: true
11-
# automatically registers your services as commands, form types, etc.
11+
# automatically registers your services as commands, event subscribers, etc.
1212
autoconfigure: true
1313
# this means you cannot fetch services directly from the container via $container->get()
1414
# if you need to do this, you can override this setting on individual services
1515
public: false
1616

17-
# loads services from whatever directories you want (you can add directories!)
17+
# makes classes in src/AppBundle available to be used as services
1818
# this creates a service per class whose id is the fully-qualified class name
1919
AppBundle\:
20-
resource: '../../src/AppBundle/{Command,Form,EventSubscriber,Twig,Security}'
20+
resource: '../../src/AppBundle/*'
21+
# you can exclude directories or files
22+
# but if a service is unused, it's removed anyways
23+
exclude: '^(AppBundle\.php|Entity|Repository)'
2124

25+
# controllers are imported separately to make sure they're public
26+
# and have a tag that allows actions to type-hint services
2227
AppBundle\Controller\:
2328
resource: '../../src/AppBundle/Controller'
2429
public: true
2530
tags: ['controller.service_arguments']
31+
32+
# add more services, or override services that need manual wiring
33+
# AppBundle\Service\ExampleService:
34+
# arguments:
35+
# $someArgument: 'some_value'

0 commit comments

Comments
 (0)