Closed GerardSmit closed 8 years ago
Thanks for the PR! :)
I'm a little hesitant about this because it bumps the version requirements to 3.2, and assumes entities are stored in Mode/Entity
namespace which isn't always the case.
Maybe the documentation should be more clear about this "feature." Is this something you ran into in your plugin tests... or elsewhere?
I've used the part of the code somewhere else; where I needed the tabel name of the model and store it. But since it didn't work with plugins I needed to add that part and wanted to give something back for it. :)
But what you said is true, since in the table you can call entityClass
. You could get the prefix of the plugin from the Plugin
class, but I don't know if it's efficent and worthfully for this plugin.
I think that in the cases where this is needed, overriding _repository()
would be okay to ask of people. I don't know that we should make assumptions from the namespace.
This will get the Table from the plugin if the entity is from a plugin.
For example:
new \Cake\ORM\Entity()
> tableEntities
new \Plugin\Model\Entity\Example()
> tablePlugin.Examples