From 10eed30cdec6cea1281bb5a5a1e6aaaa46462c48 Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Mon, 31 Oct 2011 16:15:10 +0100 Subject: [PATCH 1/4] added MessageDataCollector forward compatibility --- .../DataCollector/MessageDataCollector.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/Symfony/Bridge/Swiftmailer/DataCollector/MessageDataCollector.php diff --git a/src/Symfony/Bridge/Swiftmailer/DataCollector/MessageDataCollector.php b/src/Symfony/Bridge/Swiftmailer/DataCollector/MessageDataCollector.php new file mode 100644 index 0000000000..60f9666dff --- /dev/null +++ b/src/Symfony/Bridge/Swiftmailer/DataCollector/MessageDataCollector.php @@ -0,0 +1,24 @@ + + * + * 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. + * + * @author Fabien Potencier + * @author Clˇment JOBEILI + */ +class MessageDataCollector extends BaseMessageDataCollector +{ +} From c1426baee1bdef376dec1d05cb71b9b912c0adcf Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Mon, 31 Oct 2011 16:15:30 +0100 Subject: [PATCH 2/4] added locale handling forward compatibility --- src/Symfony/Component/HttpFoundation/Request.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index ae1bacf89b..13415f3494 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -845,6 +845,21 @@ class Request $this->format = $format; } + public function setDefaultLocale($locale) + { + $this->session->setPhpDefaultLocale($locale); + } + + public function setLocale($locale) + { + $this->session->setLocale($locale); + } + + public function getLocale() + { + return $this->session->getLocale(); + } + /** * Checks whether the method is safe or not. * From dd606b5dee57d6771cca2143fadebdeffe02ce1f Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Mon, 31 Oct 2011 16:48:41 +0100 Subject: [PATCH 3/4] added note about the purpose of this class --- .../Bridge/Swiftmailer/DataCollector/MessageDataCollector.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/Swiftmailer/DataCollector/MessageDataCollector.php b/src/Symfony/Bridge/Swiftmailer/DataCollector/MessageDataCollector.php index 60f9666dff..5b96618547 100644 --- a/src/Symfony/Bridge/Swiftmailer/DataCollector/MessageDataCollector.php +++ b/src/Symfony/Bridge/Swiftmailer/DataCollector/MessageDataCollector.php @@ -16,8 +16,7 @@ use Symfony\Bundle\SwiftmailerBundle\DataCollector\MessageDataCollector as BaseM /** * MessageDataCollector. * - * @author Fabien Potencier - * @author Clˇment JOBEILI + * Added for forwards compatibility with Symfony2.1 */ class MessageDataCollector extends BaseMessageDataCollector { From b6bf0182e970beedb85b0a39d790335295681217 Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Mon, 31 Oct 2011 17:21:22 +0100 Subject: [PATCH 4/4] tweaked error handling for the forward compatibility --- src/Symfony/Component/HttpFoundation/Request.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 13415f3494..4271bb9777 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -845,18 +845,21 @@ class Request $this->format = $format; } - public function setDefaultLocale($locale) - { - $this->session->setPhpDefaultLocale($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); } public function getLocale() { + if (!$this->hasSession()) { + throw new \LogicException('Forward compatibility for Request::getLocale() requires the session to be set.'); + } + return $this->session->getLocale(); }