-
Notifications
You must be signed in to change notification settings - Fork 57
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
Use TranslatorInterface for typehint #1058
Conversation
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.
+1, but type hint on $translator
property should be adjusted as well 😉
Please change also type hint in |
Unfortunately, unit tests failure is related to the proposed changes:
According to the discussion under original PR, it seems that the |
@adamwojs I will undo changes in the test then. |
This is not a problem in the tests. I think it is a problem with autowiring. We could explicitly add Translator as an argument or we should have two separate services injected. Discussion was here #1007 (comment) |
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.
CustomTag
class explicitly calls getCatalogue
method which is not part of an interface. TypeHint has to remain Symfony\Component\Translation\Translator
.
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.
Since I'm not the biggest fan of autowiring I'd say adding @translator
to arguments
in the service definition should be enough to resolve the issue.
I agree with @Nattfarinn and @webhdx. Reverting b89404a is not a solution. |
@adamwojs @Nattfarinn @webhdx changes are back to |
IMO, autowiring should've never been used in eZ admin UI or any vendor code. Autowiring is great when developing apps or websites to enable devs to quickly get features up and running. Using it anywhere else (basically, anywhere in |
I think we should go with |
@mikadamczyk @adamwojs @Nattfarinn @webhdx what do you suggest to do here? Problem is I have a broken project now. |
@MarioBlazek There's a bug on As for current code review: Revert change on |
We have some new findings on this problem, which should help at least reproducing the issue. One of our bundles has a dependency on Lexik Translation bundle ( https://packagist.org/packages/lexik/translation-bundle ). This bundle replaces the default class in @translator with its own implementation that extends and enriches the default Symfony translator service. When activated on the project using eZ Platform Admin UI, it will cause an error reported in this PR. Was this issue ever addressed in the kernel? |
As it seems that PR is abandoned, I allowed myself to open a new one: |
@mateuszbieniek How is this PR abandoned? Couldn't you just ask @MarioBlazek to rebase it? |
@emodric: Is this OK with you @MarioBlazek? |
@mateuszbieniek as the new PR is already created, please proceed with it, and tag fix asap. |
That doesn't make it abandoned. @MarioBlazek also asked you for feedback 6 months ago and it was ignored. So not that you actually need this fix, instead of asking @MarioBlazek to finish this PR, you're just going to ignore it, again. Not really nice thing to do. |
I'm sorry that you feel that way. As long as @MarioBlazek is OK, we can continue in either PR. |
If @MarioBlazek is okay with it, I am too. I just feel like his efforts were not recognized as they should be. |
You are right - did not think it trough. I hope that @MarioBlazek does not feel that way. If so, I apologize. |
Hi @MarioBlazek, Thank you for your contribution! |
In some cases, autowire fails with following error:
[Symfony\Component\DependencyInjection\Exception\RuntimeException] Cannot autowire service "EzSystems\EzPlatformAdminUi\UI\Config\Mapper\FieldType\RichText\CustomTag": argument "$translator" of method "__construct()" references class "Symfony\Component\Translation\Translator" but no such service exi sts. Try changing the type-hint to "Symfony\Component\Translation\TranslatorInterface" instead.