Skip to content

[Translation] Missing Alias for Services (Writer, Reader, Extractor) #25679

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
Nijusan opened this issue Jan 4, 2018 · 3 comments
Closed

[Translation] Missing Alias for Services (Writer, Reader, Extractor) #25679

Nijusan opened this issue Jan 4, 2018 · 3 comments

Comments

@Nijusan
Copy link

Nijusan commented Jan 4, 2018

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? yes
Symfony version 3.4.+

I lately updated a legacy Command to the new auto wire feature which needs the Translation Services.

After Updating the Command with:
public function __construct( TranslationWriterInterface $writer, TranslationReaderInterface $reader, ExtractorInterface $extractor ) { ...
I got the error: argument "$writer" of method "__construct()" references interface "Symfony\Component\Translation\Writer\TranslationWriterInterf
ace" but no such service exists. It cannot be auto-registered because it is from a different root namespace.

Maybe i did not read the documentation carefully or just wasnt aware of how the identification of the services is done, so only with the help of the support channel i got the hint that there are default alias for other services, but not here.

If there is no side-effect, its maybe better to just create the aliases in the core then having them defined in the own service.yml:

Symfony\Component\Translation\Extractor\ExtractorInterface: '@translation.extractor' Symfony\Component\Translation\Writer\TranslationWriterInterface: '@translation.writer' Symfony\Component\Translation\Reader\TranslationReaderInterface: '@translation.reader'

@chalasr
Copy link
Member

chalasr commented Jan 4, 2018

Adding these aliases in core sounds good to me.

@Simperfit
Copy link
Contributor

@Nijusan Do you want to provide the pull request? It seems like an easy pick to me ;).

@Nijusan
Copy link
Author

Nijusan commented Jan 6, 2018

@Simperfit i tried :) please correct me if i did something wrong

nicolas-grekas added a commit that referenced this issue Jan 7, 2018
…onReaderInterface, ExtractorInterface & TranslationWriterInterface (Dennis Langen)

This PR was merged into the 4.1-dev branch.

Discussion
----------

[FrameworkBundle] add autowiring aliases for TranslationReaderInterface, ExtractorInterface & TranslationWriterInterface

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #25679
| License       | MIT
| Doc PR        |

Supporting #25679

Commits
-------

e2ddc17 adding interface alias for reader, writer and extractor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants