Skip to content

Commit

Permalink
Merge pull request #275 from tobias-93/fix-deprecated-behavior
Browse files Browse the repository at this point in the history
Fixes compatibility for Symfony 3.0
  • Loading branch information
docteurklein committed Dec 18, 2015
2 parents a52a92a + 2f60f63 commit cef6845
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/ORM/Translatable/CurrentLocaleCallable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@ public function __construct(Container $container)

public function __invoke()
{
if (!$this->container->isScopeActive('request')) {
return;
if (!$this->container->has('request_stack')) {
if(!$this->container->isScopeActive('request')) {
return NULL;
}
$request = $this->container->get('request');

return $request->getLocale();
} else if ($request = $this->container->get('request_stack')->getCurrentRequest()) {
return $request->getLocale();
}

$request = $this->container->get('request');

return $request->getLocale();
return NULL;
}
}

0 comments on commit cef6845

Please sign in to comment.