8000 merged branch acasademont/locale_request_collector (PR #5769) · sensi/symfony@390f36a · GitHub
[go: up one dir, main page]

Skip to content

Commit 390f36a

Browse files
committed
merged branch acasademont/locale_request_collector (PR symfony#5769)
This PR was merged into the master branch. Commits ------- 20f19bf Add the Request locale to the RequestDataCollector Discussion ---------- [HttpKernel] Add the Request locale to the RequestDataCollector Bug fix: no Feature addition: yes Backwards compatibility break: no Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/acasademont/symfony.png)](http://travis-ci.org/acasademont/symfony) Fixes the following tickets: - Todo: - License of the code: MIT Documentation PR: - --------------------------------------------------------------------------- by acasademont at 2012-10-17T09:01:32Z Seems like some Twig tests are failing in the master branch
2 parents ab1a434 + 20f19bf commit 390f36a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public function collect(Request $request, Response $response, \Exception $except
9393
'flashes' => $flashes,
9494
'path_info' => $request->getPathInfo(),
9595
'controller' => 'n/a',
96+
'locale' => $request->getLocale(),
9697
);
9798

9899
if (isset($this->controllers[$request])) {
@@ -189,6 +190,11 @@ public function getFormat()
189190
return $this->data['format'];
190191
}
191192

193+
public function getLocale()
194+
{
195+
return $this->data['locale'];
196+
}
197+
192198
/**
193199
* Gets the route name.
194200
*

src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function testCollect(Request $request, Response $response)
4343
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag',$c->getRequestQuery());
4444
$this->assertEquals('html',$c->getFormat());
4545
$this->assertEquals(array(),$c->getSessionAttributes());
46+
$this->assertEquals('en',$c->getLocale());
4647

4748
$this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag',$c->getResponseHeaders());
4849
$this->assertEquals(200,$c->getStatusCode());

0 commit comments

Comments
 (0)
0