merged branch lsmith77/forward_compat (PR #2526)

Commits
-------

b6bf018 tweaked error handling for the forward compatibility
dd606b5 added note about the purpose of this class
c1426ba added locale handling forward compatibility
10eed30 added MessageDataCollector forward compatibility

Discussion
----------

Forward compat

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #2522
This commit is contained in:
Fabien Potencier 2011-11-22 19:39:27 +01:00
commit 60f8525ae5
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,23 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Swiftmailer\DataCollector;
use Symfony\Bundle\SwiftmailerBundle\DataCollector\MessageDataCollector as BaseMessageDataCollector;
/**
* MessageDataCollector.
*
* Added for forwards compatibility with Symfony2.1
*/
class MessageDataCollector extends BaseMessageDataCollector
{
}

View File

@ -845,6 +845,24 @@ class Request
$this->format = $format;
}
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);
}
public function getLocale()
{
if (!$this->hasSession()) {
throw new \LogicException('Forward compatibility for Request::getLocale() requires the session to be set.');
}
return $this->session->getLocale();
}
/**
* Checks whether the method is safe or not.
*