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

symfony controller method action suffix #2328

Open
stijn-at-work opened this issue Aug 30, 2021 · 3 comments
Open

symfony controller method action suffix #2328

stijn-at-work opened this issue Aug 30, 2021 · 3 comments

Comments

@stijn-at-work
Copy link

We are upgrading our app to Symfony 4. The Symfony docs state that the action suffix is no longer needed for controller method names.

The first Symfony versions required that controller method names ended in Action (e.g. newAction(), showAction()). This suffix became optional when annotations were introduced for controllers. In modern Symfony applications this suffix is neither required nor recommended, so you can safely remove it.

Our controller methods extend AbstractFosRestController.

When removing the Action suffix and run bin/console debug:route, I get an error.

Are you planning to update the source code to comply with this Symfony recommendation?

@stijn-at-work stijn-at-work changed the title action suffix symfony controller method action suffix Aug 30, 2021
@W0rma
Copy link
Contributor

W0rma commented Sep 3, 2021

When removing the Action suffix and run bin/console debug:route, I get an error.

Which error do you get and which version of FOSRestBundle do you use?

@InjustFr
Copy link

This is probably not an issue with FOSRestBundle. All my controller methods do not have an action suffix and they work just fine

@shakaran
Copy link

shakaran commented Aug 4, 2023

@stijn-at-work since a lot time have past, do you have still the same experiencie with Symfony 5 or 6 version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants