Is there an easy way in cakephp to get an array of tables schema for a list of specific tables? For example, i want a table schema for table a, b, d, f, and z; Also, is there a way to get a schema array of all the tables?
Get a datasource, by:
$db =& ConnectionManager::getDataSource('default');
or
$db =& $this->User->getDataSource(); // or any other model
Then you can get all the tables by calling:
$db->listSources()
And get the schema for a table, say "products"
$db->describe('products');
However, passing a string to describe
is only in CakePHP 2.0, 1.3 requires a model object.
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