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

3.x: remove unnecessary parent call in table class #1025

Closed
wants to merge 1 commit into from
Closed

Conversation

LordSimal
Copy link
Contributor

There is no need to call parent::initialize($config); in a baked Table class since we don't actually do anything in there.

@LordSimal LordSimal added this to the 3.x (CakePHP 5) milestone Dec 28, 2024
@dereuromark
Copy link
Member

But if we, like me, use a different base class after baking you suddenly need it.
I would be rather having it consistently call it and have it no-op by default than having to wry about adding it.

@LordSimal
Copy link
Contributor Author

LordSimal commented Dec 28, 2024

But if we, like me, use a different base class after baking you suddenly need it.
I would be rather having it consistently call it and have it no-op by default than having to wry about adding it.

If you introduce your own inheritance logic then I'd say its logical to add that parent call yourself, not rely on the Framework to do the thinking for you.

I think its just misleading that sometimes the parent call does something for our code (like Application::bootstrap) and sometimes it doesn't because "maybe you need it later"

@ADmad
Copy link
Member

ADmad commented Dec 28, 2024

I too would prefer keeping the parent call for consistency. We have it for the controller class too.

@LordSimal LordSimal closed this Dec 28, 2024
@LordSimal LordSimal deleted the 3.x-cleanup branch December 28, 2024 20:32
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

Successfully merging this pull request may close these issues.

3 participants