tweaked error handling for the forward compatibility

This commit is contained in:
Lukas Kahwe Smith 2011-10-31 17:21:22 +01:00
parent dd606b5dee
commit b6bf0182e9

View File

@ -845,18 +845,21 @@ class Request
$this->format = $format; $this->format = $format;
} }
public function setDefaultLocale($locale)
{
$this->session->setPhpDefaultLocale($locale);
}
public function setLocale($locale) public function setLocale($locale)
{ {
if (!$this->hasSession()) {
throw new \LogicException('Forward compatibility for Request::setLocale() requires the session to be set.');
}
$this->session->setLocale($locale); $this->session->setLocale($locale);
} }
public function getLocale() public function getLocale()
{ {
if (!$this->hasSession()) {
throw new \LogicException('Forward compatibility for Request::getLocale() requires the session to be set.');
}
return $this->session->getLocale(); return $this->session->getLocale();
} }