Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c8050b1
Adding the ADR approach.
Guikingone Jul 14, 2017
0d0d4cc
Update service.rst
Guikingone Jul 14, 2017
7359837
Update service.rst
Guikingone Jul 14, 2017
885e696
Update service.rst
Guikingone Jul 14, 2017
220021e
Update service.rst
Guikingone Jul 14, 2017
1fda263
Update service.rst
Guikingone Jul 14, 2017
11c77c7
Update service.rst
Guikingone Jul 14, 2017
d21feb2
Update service.rst
Guikingone Jul 15, 2017
a449220
Update service.rst
Guikingone Jul 17, 2017
6d1ed62
Update service.rst
Guikingone Jul 17, 2017
a81b625
Update service.rst
Guikingone Aug 3, 2017
8444e98
Added the dedicated file and link from service.rst
Guikingone Aug 3, 2017
a93fa6c
Update adr.rst
Guikingone Aug 3, 2017
97bcbac
Update adr.rst
Guikingone Aug 3, 2017
72c2c74
Update service.rst
Guikingone Aug 3, 2017
666a89f
Update adr.rst
Guikingone Aug 3, 2017
c8625fb
Update adr.rst
Guikingone Aug 5, 2017
0d2022a
Corrected the index typo.
Guikingone Aug 5, 2017
582f4bf
Update adr.rst
Guikingone Aug 5, 2017
a237312
Update adr.rst
Guikingone Aug 6, 2017
cd46501
Update adr.rst
Guikingone Aug 16, 2017
24416f5
Update adr.rst
Guikingone Sep 12, 2017
dc6ddc6
Update adr.rst
Guikingone Oct 16, 2017
f1aad20
Update adr.rst
Guikingone Oct 16, 2017
16c8472
Update adr.rst
Guikingone Oct 16, 2017
eca9a0a
[ADD](Responder classe)[!P2]
Guikingone Nov 24, 2017
aa0a207
[FIX](Syntax)[!P2]
Guikingone Nov 24, 2017
551aed6
[FIX](ADR Repository)[!P2]
Guikingone Nov 24, 2017
3dacc68
fix(typo): fix on typo and space.
Guikingone Jan 24, 2018
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update adr.rst
Removed the RequestStack injection.
  • Loading branch information
Guikingone authored Aug 16, 2017
commit cd4650122634a842fac6ed10f8669704e5e7cdc5
36 changes: 4 additions & 32 deletions controller/adr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,40 +127,12 @@ the request from simple method injection like this ::

public function __invoke(Request $request): Response
{
return new Response($this->twig->render('default/index.html.twig'));
$id = $this->requestStack->getCurrentRequest()->get('id');

return new Response($this->twig->render('default/index.html.twig', array('id' => $id));
}
}

Like you can easily imagine, the :class:`Symfony\\Component\\Httpfoundation\\RequestStack` is the best option to gain access to the request, using this approach, a simple update is recommended and the access to request parameters is way easier::

<?php

namespace AppBundle\Action;

use Twig\Environment;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RequestStack;

final class HelloAction
{
private $requestStack;

private $twig;

public function __construct(RequestStack $requestStack, Environment $twig)
{
$this->requestStack = $requestStack
$this->twig = $twig;
}

public function __invoke(): Response
{
$data = $this->requestStack->getCurrentRequest()->get('id');

return new Response($this->twig->render('default/index.html.twig', array('data' => $data));
}
}


Final thought
-------------

Expand Down