Skip to content
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

Update page_creation.rst #5644

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions book/page_creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Just add a second method to ``LuckyController``::
// src/AppBundle/Controller/LuckyController.php
// ...

class LuckyController
class LuckyController extends Controller
{
// ...

Expand Down Expand Up @@ -137,7 +137,7 @@ You can even shorten this with the handy :class:`Symfony\\Component\\HttpFoundat
// --> don't forget this new use statement
use Symfony\Component\HttpFoundation\JsonResponse;

class LuckyController
class LuckyController extends Controller
Copy link
Member

Choose a reason for hiding this comment

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

well, this example does not depend on any method of the base class. So why extending it ?

Copy link
Member

Choose a reason for hiding this comment

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

As this article describes how to create one action. So each code example is based on the previous example. It would be very strange to have the extends part in all examples but one.

Also, as this article is focused on beginners, it's confusion when not extending Controller imo.

Copy link
Member

Choose a reason for hiding this comment

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

@wouterj I'd like to ask you something about this LuckyController. What do you think about renaming it to DefaultController? This code is shown very early in the book and it's linked from the new Symfony Welcome Page, so most of the readers will be newcomers.

{
// ...

Expand Down Expand Up @@ -170,7 +170,7 @@ at the end:
// src/AppBundle/Controller/LuckyController.php
// ...

class LuckyController
class LuckyController extends Controller
{
/**
* @Route("/lucky/number/{count}")
Expand Down Expand Up @@ -224,7 +224,7 @@ The best part is that you can access this value and use it in your controller::
// src/AppBundle/Controller/LuckyController.php
// ...

class LuckyController
class LuckyController extends Controller
{

/**
Expand Down