Skip to content

[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

Merged
merged 7 commits into from
Dec 1, 2017
Merged

[Flex] Update routing & controller chapters #8592

merged 7 commits into from
Dec 1, 2017

Conversation

weaverryan
Copy link
Member

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.

Copy link
Member

@javiereguiluz javiereguiluz left a 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.

@@ -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
Copy link
Member

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:
Copy link
Member

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
Copy link
Member

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")
Copy link
Member

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']
Copy link
Member

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.
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo woud -> would?

@weaverryan weaverryan changed the base branch from master to 4.0 December 1, 2017 03:56
@weaverryan weaverryan merged commit 0cbbc28 into symfony:4.0 Dec 1, 2017
weaverryan added a commit that referenced this pull request Dec 1, 2017
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
@weaverryan weaverryan deleted the new-routing-update branch December 1, 2017 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants