Skip to content

Conversation

@ADmad
Copy link
Member

@ADmad ADmad commented Jun 3, 2020

@ADmad ADmad added this to the 4.next milestone Jun 3, 2020
@ADmad ADmad force-pushed the deprecate-table-registry branch 2 times, most recently from 14acdae to 067708e Compare June 3, 2020 17:01
use Cake\Mailer\Email;

TableRegistry::getTableLocator()->get('ThirdPartyPlugin.Feedbacks')
FactoryLocator::get('Table')->get('ThirdPartyPlugin.Feedbacks')
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member Author

@ADmad ADmad Jun 4, 2020

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.

Copy link
Member

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 ...

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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.

@ADmad ADmad force-pushed the deprecate-table-registry branch from 067708e to 47fc1f4 Compare June 5, 2020 07:52
@ADmad ADmad merged commit 6047d76 into 4.next Jun 6, 2020
@ADmad ADmad deleted the deprecate-table-registry branch June 6, 2020 16:34
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.

5 participants