-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Improved autowiring support for templating helpers #217
Conversation
CHANGELOG.md
Outdated
## 2.4.2 | ||
### Added | ||
- Improved autowiring support for templating helpers | ||
|
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.
Don't edit this file please, we will do it ourselves when releasing.
src/Resources/config/autowire.xml
Outdated
<services> | ||
<service id="Sonata\IntlBundle\Templating\Helper\DateTimeHelper" alias="sonata.intl.templating.helper.datetime" /> | ||
<service id="Sonata\IntlBundle\Templating\Helper\LocaleHelper" alias="sonata.intl.templating.helper.locale" /> | ||
<service id="Sonata\IntlBundle\Templating\Helper\NumberHelper" alias="sonata.intl.templating.helper.number" /> |
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.
Depending on the outcome of this discussion, I think it might be worth renaming the services, and doing the aliasing the other way around: <service id="sonata.intl.templating.helper.datetime" alias="Sonata\IntlBundle\Templating\Helper\DateTimeHelper" />
.
I'm not quite sure the current best practice is really that good.
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.
@greg0ire IMO we could refactor this later across all bundles, but this PR looks "helpful" and fixes some DX problems for now.
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.
Ok. @XWB please fix the build
059501b
to
17d129d
Compare
@greg0ire All fixed, just the lint test fails due to an unrelated file issue. |
new version of phpcs fixer, just ignore that. |
Related, unrelated, if you want this merged, you will have to either fix it yourself or wait for a fix. |
but in a new PR. |
CS issue has been fixed in #218 |
@OskarStark All done, all green :) |
Thanks @XWB ! |
@greg0ire @OskarStark Would you guys consider tagging a new release? |
Sure, expect it tomorrow night! |
I am targeting this branch, because there should be a next 2.x release with this fix.
Changelog
Subject
Trying to auto wire the templating helpers throws the following error:
The solution is rather easy: add templating services based on their FQCN and alias them to the existing services to maintain backwards compatibility.