-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Showcase short definition syntax #575
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
Conversation
app/config/services.yml
Outdated
|
||
# needed for the localizeddate Twig filter | ||
Twig\Extensions\IntlExtension: ~ | ||
Twig\Extensions\IntlExtension: ~ # same as [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ogizanagi, I think it should be same as null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. ~
means null
using yaml.
But actually, configuring null
for a service definition does not mean anything, and is converted to an empty array behind the scene.
I felt like adding this comment would help the user to understand the service definition is either the full mapping of definition's attributes ({ attributes: [...], tags: [...], public: false, ... }
) or directly the list (or mapping for named arguments) of constructor parameters.
But maybe that's not necessary.
app/config/services.yml
Outdated
arguments: | ||
$sender: '%app.notifications.email_sender%' | ||
# The short syntax can also be inlined: | ||
AppBundle\EventListener\CommentNotificationSubscriber: { $sender: '%app.notifications.email_sender%' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to be consistent and use the same syntax in the whole app, i.e.:
AppBundle\EventListener\CommentNotificationSubscriber:
$sender: '%app.notifications.email_sender%'
You explain the Yaml syntax here, which is not related to the Symfony Demo I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, let's do this. :)
6d68add
to
fcca1cb
Compare
@ogizanagi thanks for this! I like it ... and I didn't remember this shortcut syntax, so it's great to re-learn it! |
No description provided.