8000 [WIP] make the app/config/services.yml file use the new Symfony autoregistration and autowiring features. by hhamon · Pull Request #483 · symfony/demo · GitHub
[go: up one dir, main page]

Skip to content

[WIP] make the app/config/services.yml file use the new Symfony autoregistration and autowiring features. #483

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

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[app] simplify services configuration.
  • Loading branch information
Hugo Hamon committed Feb 21, 2017
commit 2f5ab24e0af7b84ae0aed9142005ecb2c8019025
11 changes: 5 additions & 6 deletions app/config/services.yml
8000
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,17 @@ services:
# In this example, the classes found in the following directories will be
# automatically registered as services:
#
# * src/AppBundle/EventListener/
# * src/AppBundle/Form/Type/
# * src/AppBundle/Security/
# * src/AppBundle/Twig/
# * src/AppBundle/Utils/
#
# Thus, only the classes whose corresponding filename ends with the "Subscriber.php"
# suffix in the src/AppBundle/EventListener/ directory will be registered as
# services in the service container. Other classes of this directory will be simply
# ignored.
# The "resource" attribute can accept more specific glob patterns like
# "{EventListener/*Subscriber.php,Form/Type/*Type.php}".
AppBundle\:
# Register all classes in the src/AppBundle directory as services
resource: '../../src/AppBundle/{EventListener/*Subscriber.php,Form/Type,Security,Twig,Utils}'
resource: '../../src/AppBundle/{EventListener,Form/Type,Security,Twig,Utils}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most form types don't need to be registered as services at all (they need to become services only when they have dependencies).
And as this is broken currently because you define private services, you could avoid doing it for all of them

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the current implementation is broken. I'm working on a PR to make form type services privatable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If symfony/symfony-standard#1070 is merged, this will simplify


# The other section defines a rule to automatically register and autowire the
# controller classes found in the src/AppBundle/Controller/ directory.
Expand Down Expand Up @@ -116,7 +115,7 @@ services:
# Those events are defined in the tags added to the service definition.
# See http://symfony.com/doc/current/event_dispatcher.html#creating-an-event-listener
AppBundle\EventListener\CommentNotificationListener:
arguments: ['@mailer', '@router', '@translator', '%app.notifications.email_sender%']
$sender: '%app.notifications.email_sender%'
# The "method" attribute of this tag is optional and defaults to "on + camelCasedEventName"
# If the event is "comment.created" the method executed by default is "onCommentCreated()".
tags:
Expand Down
0