lithium\data\source\database\adapter\MySql::sources()
Implements
lithium\data\Source::sources()
Returns the list of tables in the currently-connected database.
Parameters
-
string
$model
The fully-name-spaced class name of the model object making the request.
Returns
arrayReturns an array of sources to which models can connect.
Filter
This method can be filtered.
Source
public function sources($model = null) {
$params = compact('model');
return Filters::run($this, __FUNCTION__, $params, function($params) {
$name = $this->name($this->_config['database']);
if (!$result = $this->_execute("SHOW TABLES FROM {$name};")) {
return null;
}
$sources = [];
foreach ($result as $row) {
$sources[] = $row[0];
}
return $sources;
});
}