I'm looking for a way to get a list of all available table objects. These are all the classes that are (by default) located under App/Modal/Table
and that are handled by TableRegistry
. How to get a list of all those objects?
I know it's possible to fetch all tables of the db:
$tables = ConnectionManager::get('default')->schemaCollection()->listTables();
And then using TableRegistry::get()
to get the table object.
But this is not possible for my solution, because there are two cases where this does not work:
- custom table names that are different to the table object name
- plugin table objects
Any ideas?
Edit: Why? I need all table objects that use a behavior X. In my case a custom SearchableBehavior, which updates a searchindex table on each afterSave event for the saved entity. To update the searchindex for all entities of all tables, I need to know which tables are using the SearchableBehavior and call their update method manually.