Skip to content
This repository has been archived by the owner on Jul 4, 2018. It is now read-only.

Commit

Permalink
made it easier to replace the translator service with an implementati…
Browse files Browse the repository at this point in the history
…on of TranslatorInterface
  • Loading branch information
fabpot committed Jun 30, 2014
1 parent 215251c commit d7500db
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Silex/Provider/FormServiceProvider.php
Expand Up @@ -72,7 +72,7 @@ public function register(Container $app)
if (isset($app['validator'])) {
$extensions[] = new FormValidatorExtension($app['validator']);

if (isset($app['translator'])) {
if (isset($app['translator']) && method_exists($app['translator'], 'addResource')) {
$r = new \ReflectionClass('Symfony\Component\Form\Form');
$app['translator']->addResource('xliff', dirname($r->getFilename()).'/Resources/translations/validators.'.$app['locale'].'.xlf', $app['locale'], 'validators');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Silex/Provider/ValidatorServiceProvider.php
Expand Up @@ -31,7 +31,7 @@ public function register(Container $app)
$app['validator'] = function ($app) {
$r = new \ReflectionClass('Symfony\Component\Validator\Validator');

if (isset($app['translator'])) {
if (isset($app['translator']) && method_exists($app['translator'], 'addResource')) {
$app['translator']->addResource('xliff', dirname($r->getFilename()).'/Resources/translations/validators.'.$app['locale'].'.xlf', $app['locale'], 'validators');
}

Expand Down

0 comments on commit d7500db

Please sign in to comment.