-
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
EZP-31547: Autowiring fails for CustomTag service when using 3rd party translator bundle #1335
Conversation
…nd TranslatorBagInterface
As mentioned by @webhdx #1007 (comment) here, the provided solution seems like overkill, but without we will encounter issues like Another alternative would be solution used by Symfony, but I'm not sold. /**
* @var TranslatorInterface|TranslatorBagInterface
*/
private $translator;
/**
* @param TranslatorInterface $translator The translator must implement TranslatorBagInterface
*/
public function __construct(TranslatorInterface $translator)
{
if (!$translator instanceof TranslatorBagInterface) {
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', \get_class($translator)));
}
$this->translator = $translator;
} WDYT? |
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 prefer approach with two separate interfaces, as-is ATM, even though ATM it's the same Service. It's more SOLID.
Keep in mind that merge up might require extra effort due to switch to \Symfony\Contracts
.
src/lib/Tests/UI/Config/Mapper/FieldType/RichText/CustomTagTest.php
Outdated
Show resolved
Hide resolved
b9922e3
to
8c72a02
Compare
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.
QA approved on eZPlatform 2.5 EE with patch & diff.
Merge up for |
This is continuation for #1058
This PR adds
$translator
argument toEzSystems\EzPlatformAdminUi\UI\Config\Mapper\FieldType\RichText\CustomTag
to prevent autowiring issues.