Skip to content

Commit

Permalink
Ignore missing translation dependency in FrameworkBundle
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alcaeus committed Jul 22, 2019
1 parent 376a8f4 commit 19eb90d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<argument type="service" id="validator.validator_factory" />
</call>
<call method="setTranslator">
<argument type="service" id="translator" />
<argument type="service" id="translator" on-invalid="ignore" />
</call>
<call method="setTranslationDomain">
<argument>%validator.translation_domain%</argument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ public function testValidation()
$this->assertSame('setConstraintValidatorFactory', $calls[0][0]);
$this->assertEquals([new Reference('validator.validator_factory')], $calls[0][1]);
$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(['%validator.translation_domain%'], $calls[2][1]);
$this->assertSame('addXmlMappings', $calls[3][0]);
Expand Down

0 comments on commit 19eb90d

Please sign in to comment.