Skip to content

Commit 4cbbbb5

Browse files
author
Hugo Hamon
committed
[book] changed ->get('request') to ->getRequest().
1 parent eda47f5 commit 4cbbbb5

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

book/http_cache.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ md5 of the content::
547547
{
548548
$response = $this->renderView('MyBundle:Main:index.html.twig');
549549
$response->setETag(md5($response->getContent()));
550-
$response->isNotModified($this->get('request'));
550+
$response->isNotModified($this->getRequest());
551551

552552
return $response;
553553
}
@@ -598,7 +598,7 @@ header value::
598598
$date = $authorDate > $articleDate ? $authorDate : $articleDate;
599599

600600
$response->setLastModified($date);
601-
$response->isNotModified($this->get('request'));
601+
$response->isNotModified($this->getRequest());
602602

603603
return $response;
604604
}
@@ -643,7 +643,7 @@ exposing a simple and efficient pattern::
643643
$response->setLastModified($article->getPublishedAt());
644644

645645
// Check that the Response is not modified for the given Request
646-
if ($response->isNotModified($this->get('request'))) {
646+
if ($response->isNotModified($this->getRequest())) {
647647
// return the 304 Response immediately
648648
return $response;
649649
} else {

book/security.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,16 +403,19 @@ Next, create the controller that will display the login form:
403403
{
404404
public function loginAction()
405405
{
406+
$request = $this->getRequest();
407+
$session = $request->getSession();
408+
406409
// get the login error if there is one
407-
if ($this->get('request')->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
408-
$error = $this->get('request')->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
410+
if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
411+
$error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
409412
} else {
410-
$error = $this->get('request')->getSession()->get(SecurityContext::AUTHENTICATION_ERROR);
413+
$error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
411414
}
412415
413416
return $this->render('AcmeSecurityBundle:Security:login.html.twig', array(
414417
// last username entered by the user
415-
'last_username' => $this->get('request')->getSession()->get(SecurityContext::LAST_USERNAME),
418+
'last_username' => $session->get(SecurityContext::LAST_USERNAME),
416419
'error' => $error,
417420
));
418421
}

book/templating.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ pattern is to do the following:
11551155
11561156
public function indexAction()
11571157
{
1158-
$format = $this->get('request')->getRequestFormat();
1158+
$format = $this->getRequest()->getRequestFormat();
11591159
11601160
return $this->render('AcmeBlogBundle:Blog:index.'.$format.'.twig');
11611161
}

0 commit comments

Comments
 (0)