-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[DX] ADR usage #8153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DX] ADR usage #8153
Changes from 1 commit
c8050b1
0d0d4cc
7359837
885e696
220021e
1fda263
11c77c7
d21feb2
a449220
6d1ed62
a81b625
8444e98
a93fa6c
97bcbac
72c2c74
666a89f
c8625fb
0d2022a
582f4bf
a237312
cd46501
24416f5
dc6ddc6
f1aad20
16c8472
eca9a0a
aa0a207
551aed6
3dacc68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
.. index:: | ||
single: Action Domain Responder approach | ||
single: Action Domain Responder approach | ||
|
||
How to implement the ADR pattern | ||
================================ | ||
|
||
In Symfony, you're used to implement the MVC pattern and extending the default :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller` | ||
class. | ||
class. | ||
Since the 3.3 update, Symfony is capable of using natively the ADR approach. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it is worth it to add a link to https://github.com/pmjones/adr |
||
|
||
Updating your configuration | ||
|
@@ -109,7 +109,7 @@ Once this is done, you can define the routes like before using multiples approac | |
|
||
// app/config/routing.php | ||
use AppBundle\Action\HelloAction | ||
|
||
$collection->add('hello', new Route('/hello', array( | ||
'_controller' => HelloAction::class, | ||
))); | ||
|
@@ -156,7 +156,7 @@ Like you can easily imagine, the :class:`Symfony\\Component\Httpfoundation\Reque | |
public function __invoke() : Response | ||
{ | ||
$data = $this->requestStack->getCurrentRequest()->get('id'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
return new Response($this->twig->render('default/index.html.twig', array('data' => $data)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think PHP7 is assumed in the doc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think we should use the [] syntax? |
||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Symfony has never promoted the MVC pattern (at least, not since version 2). Instead, we are presenting Symfony as being a Request/Response framework where the controller converts a Request to a Response via a Controller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, my apologies for this words, the meaning of my "text" was to clearly say that a lot of developers use Symfony with MVC and that using this pattern is way more used than just transforming a Request into Response (which is handled by the framework in a certain way, the actual transformation occurs in the controller).