-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Flex] Update routing & controller chapters #8592
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
Conversation
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.
It's so nice that newer Symfony versions allow us to remove many more lines than we add when upgrading articles. I love it! Thanks for updating this.
page_creation.rst
Outdated
@@ -273,7 +285,7 @@ project: | |||
``src/`` | |||
All your PHP code lives here. | |||
|
|||
99% of the time, you'll be working in ``src/`` (PHP files) or ``config/`` (everything | |||
Most of the time, you'll be working in ``src/`` (PHP files) or ``config/`` (everything |
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.
Maybe we should remove this phrase entirely? You now have lots of dirs to work on (templates, translations, assets, ...) It's not true that most of the time you are in src/ and config/
controller.rst
Outdated
via ``$this->get()`` or ``$this->container->get()``. This forces you to write | ||
more robust code to access services. But if you *do* need direct access to the | ||
container, using ``Controller`` is fine. | ||
What's the difference between ``Controller`` or ``AbstractController``. Not much: |
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.
There's a missing ?
at the end of this question.
controller.rst
Outdated
more robust code to access services. But if you *do* need direct access to the | ||
container, using ``Controller`` is fine. | ||
What's the difference between ``Controller`` or ``AbstractController``. Not much: | ||
both are identical, except that ``AbstractController`` is more restrictive: it |
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.
I don't like this AbstractController vs Controller thing :( For this introductory article is confusing and it forces the user to make a decision they cannot make at this point (because they know nothing about services and container and get(...)).
But at the same time this is probably the best place to talk about this ... so I'm really confused!
@@ -64,9 +34,9 @@ class:: | |||
class LuckyController | |||
{ | |||
/** | |||
* @Route("/lucky/number/{max}") | |||
* @Route("/lucky/number/{max}", name="app_lucky_number") |
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.
Is this app_
prefix a good practice for route names? I'd never do that and it makes routes a bit long ... but if you consider it a good practice, then it's OK.
|
||
$collection = new RouteCollection(); | ||
$collection->add('blog_list', new Route('/blog', array( | ||
'_controller' => 'AppBundle:Blog:list', | ||
'_controller' => [BlogController::class, 'list'] |
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.
use long array syntax instead?
routing.rst
Outdated
controller. Along the way, you'll learn all sorts of tricks that make mapping | ||
even the most complex URLs easy. | ||
configure your routes in YAML, XML or PHP, that's no problem! Just create a | ||
new routing file (e.g. ``routing.xml``) and Symfony will automatically use it. |
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.
routing.xml
-> routes.xml
routing.rst
Outdated
|
||
Having flexibility is even more important. What if you need to change the | ||
URL of a page from ``/blog`` to ``/news``? How many links should you need to | ||
URL of a page from ``/blog`` to ``/news``? How many links woud you need to |
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.
typo woud
-> would
?
This PR was squashed before being merged into the 4.0 branch (closes #8592). Discussion ---------- [Flex] Update routing & controller chapters More progress in updating all of the "Getting Started" guides. I will next do templating, configuration (though this has been done in #8588) and also `service_container`, which I'd like to move into Getting Started. Commits ------- 0cbbc28 fixing build errors 7f0163a tweaks 10563a9 Proofing the controller chapters 44f2ff8 more work on getting started docs 218e2d4 WIP controller chapter 8b923e6 WIP controller changes 89d56ea Updating routing for Flex
More progress in updating all of the "Getting Started" guides. I will next do templating, configuration (though this has been done in #8588) and also
service_container
, which I'd like to move into Getting Started.