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

Controller classes have been changed to final #3257

Open
henrypenny opened this issue Mar 2, 2023 · 1 comment
Open

Controller classes have been changed to final #3257

henrypenny opened this issue Mar 2, 2023 · 1 comment

Comments

@henrypenny
Copy link
Contributor

henrypenny commented Mar 2, 2023

I'm trying to update an older Kunstmaan CMS site to Symfony 5.
There are a lot of controllers in the project that extend the Kunstmaan Controller classes.
I'm finding that many of them are now final
This is making my upgrade process incredibly frustrating.
What is the benefit of these classes being final? This is a big BC break for me.
I'm having to copy and paste code out of the kunstmaan classes into user land controllers.

e.g.: final class SettingsController extends AbstractController

@acrobat
Copy link
Member

acrobat commented Jun 10, 2023

Hi @henrypenny, sorry for the late answer! Regarding the final classes, this is a decision made to ease the maintainability of the code. In the past all classes where open to extension or had public properties/methods anyone could use and this made it hard to do required refactorings to improve our code base or add compatibility for newer symfony versions without breaking backwards compatibility.

That's why we decided to mark certain classes as final to allows us to make changes easier in the future. Those controllers have been marked with @final in the 5.x versions, thus triggering a symfony deprecation when you extend from these classes. So no BC break in theory. I ofcourse understand this might make some implementations difficult and ideally the controller logic is moved to a service, so that the controller just passed the request to a service and it returns a response. This way users of the cms can implement their own logic via a custom service.

Can you share some use cases where you have issues with now? Let's review those cases and find a solution that works for everbody!

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

2 participants