List of all tables in cakePHP 3.x

I tried to work on it. In cakePHP 2, I could use:

$tables = ConnectionManager::getDataSource('default')->listSources();

But in CakePHP 3.x I cannot figure out what to use? I looked at the cakephp link to get the schema for the list of tables

Unfortunately this does not help with cakePHP 3.0?

+2
source share
2 answers

We can get a list of tables in cakephp3 using a very similar template, like

$tables = ConnectionManager::get('default')->schemaCollection()->listTables();
+4
source

I had the same problem. Try using the code below

TableRegistry::exists($model);
+1
source

All Articles