问题
I have been trying to work this one out. In cakePHP 2 I could use:
$tables = ConnectionManager::getDataSource('default')->listSources();
But in CakePHP 3.x I can't work out what to use? I have looked at the link cakephp get schema for list of tables
Unfortunately it doesnt help with cakePHP 3.0?
回答1:
We can get list of table in cakephp3 using very similar pattern as
$tables = ConnectionManager::get('default')->schemaCollection()->listTables();
回答2:
I just had the same problem. Try using the code below
TableRegistry::exists($model);
来源:https://stackoverflow.com/questions/30255196/list-all-tables-in-cakephp-3-x