Get data source:
$db =& ConnectionManager::getDataSource('default');
or
$db =& $this->User->getDataSource();
Then you can get all the tables by calling:
$db->listSources()
And get the schema for the table, say, "products"
$db->describe('products');
However, passing a string in describe only in CakePHP 2.0 , 1.3 requires a model object.
source
share