Ignore missing translation dependency in FrameworkBundle
When using symfony/framework-bundle with symfony/validator installed but without symfony/translation, the call to setTranslator will error out because of the missing translator service. Thus, the call to setTranslator needs to ignore a missing translator dependency to support this scenario.
This commit is contained in:
parent
376a8f4cab
commit
19eb90d8cf
@ -23,7 +23,7 @@
|
|||||||
<argument type="service" id="validator.validator_factory" />
|
<argument type="service" id="validator.validator_factory" />
|
||||||
</call>
|
</call>
|
||||||
<call method="setTranslator">
|
<call method="setTranslator">
|
||||||
<argument type="service" id="translator" />
|
<argument type="service" id="translator" on-invalid="ignore" />
|
||||||
</call>
|
</call>
|
||||||
<call method="setTranslationDomain">
|
<call method="setTranslationDomain">
|
||||||
<argument>%validator.translation_domain%</argument>
|
<argument>%validator.translation_domain%</argument>
|
||||||
|
@ -674,7 +674,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
$this->assertSame('setConstraintValidatorFactory', $calls[0][0]);
|
$this->assertSame('setConstraintValidatorFactory', $calls[0][0]);
|
||||||
$this->assertEquals([new Reference('validator.validator_factory')], $calls[0][1]);
|
$this->assertEquals([new Reference('validator.validator_factory')], $calls[0][1]);
|
||||||
$this->assertSame('setTranslator', $calls[1][0]);
|
$this->assertSame('setTranslator', $calls[1][0]);
|
||||||
$this->assertEquals([new Reference('translator')], $calls[1][1]);
|
$this->assertEquals([new Reference('translator', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)], $calls[1][1]);
|
||||||
$this->assertSame('setTranslationDomain', $calls[2][0]);
|
$this->assertSame('setTranslationDomain', $calls[2][0]);
|
||||||
$this->assertSame(['%validator.translation_domain%'], $calls[2][1]);
|
$this->assertSame(['%validator.translation_domain%'], $calls[2][1]);
|
||||||
$this->assertSame('addXmlMappings', $calls[3][0]);
|
$this->assertSame('addXmlMappings', $calls[3][0]);
|
||||||
|
Reference in New Issue
Block a user