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?
The beforeFilter() method will be called for missing actions, and scaffolded actions. Controller::beforeRender() Called after controller action logic, but before the view is rendered. This callback is not used often, but may be needed if you are calling render() manually before the end of a given action.
To apply ordering, you can use the order method: $query = $articles->find() ->order(['title' => 'ASC', 'id' => 'ASC']); When calling order() multiple times on a query, multiple clauses will be appended. However, when using finders you may sometimes need to overwrite the ORDER BY .
We can get list of table in cakephp3 using very similar pattern as
$tables = ConnectionManager::get('default')->schemaCollection()->listTables();
I just had the same problem. Try using the code below
TableRegistry::exists($model);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With