-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Deprecate TableRegistry. #6657
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
Deprecate TableRegistry. #6657
Conversation
14acdae to
067708e
Compare
| use Cake\Mailer\Email; | ||
|
|
||
| TableRegistry::getTableLocator()->get('ThirdPartyPlugin.Feedbacks') | ||
| FactoryLocator::get('Table')->get('ThirdPartyPlugin.Feedbacks') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you thinking that we are early enough in 4.x that we don't need the 'before x do y' type language?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally liked the method call, instead of the additional magic string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markstory Usage like FactoryLocator::get('Table')->get('ThirdPartyPlugin.Feedbacks') works even in 3.x. So we don't need any before x do y type language.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe he means "Prior to 4.1, use ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@othercorey Yes I get that, but it's not necessary since the new usage shown actually works since 3.x.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think those should be kept, as the get('Table') part should not be leaking to the developer, mainly for usability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Practically everywhere else the examples have been updated to use $this->getTableLocator(). This particular example shows setting an event listener in bootstrap.php for global event manager using a closure, hence using FactoryLocator directly is the only way.
067708e to
47fc1f4
Compare
Refs cakephp/cakephp#14666