列出 cakePHP 中的所有表 3.x
List all tables in cakePHP 3.x
我一直在努力解决这个问题。在 cakePHP 2 中我可以使用:
$tables = ConnectionManager::getDataSource('default')->listSources();
但是在 CakePHP 中 3.x 我不知道该用什么?
我看过 link cakephp get schema for list of tables
很遗憾,它对 cakePHP 3.0 没有帮助?
我们可以使用与
非常相似的模式在 cakephp3 中获取 table 的列表
$tables = ConnectionManager::get('default')->schemaCollection()->listTables();
我刚遇到同样的问题。
尝试使用下面的代码
TableRegistry::exists($model);
我一直在努力解决这个问题。在 cakePHP 2 中我可以使用:
$tables = ConnectionManager::getDataSource('default')->listSources();
但是在 CakePHP 中 3.x 我不知道该用什么? 我看过 link cakephp get schema for list of tables
很遗憾,它对 cakePHP 3.0 没有帮助?
我们可以使用与
非常相似的模式在 cakephp3 中获取 table 的列表$tables = ConnectionManager::get('default')->schemaCollection()->listTables();
我刚遇到同样的问题。 尝试使用下面的代码
TableRegistry::exists($model);