i am creating a shell in cakephp to print a data from a model, following this tutorial about Creating Shells & Tasks
class ReportShell extends Shell {
var $uses = array('Report');
function main() {
$reports = $this->Report->findAll();
foreach($reports as $report) {
$this->out('Report Name: ' . $report['Report']['name'] . "\n");
}
$this->out("Total Reports: " . count($reports) . "\n");
}
}
but then when i typed $cake report on the console, i get this error message:
Fatal error: Unable to load DataSource file dbo\dbo_mysql_ex.php in
C:\xampp\htdocs\cake_test\core\cake\libs\model\connection_manager.php on line 178
any idea how should i fix this?
UPDATE:
following @olezhek suggestion, i have edited my database.php file and use “mysql” instead of “mysql_ex”, i am indeed getting a different error message, which stated that i have an undefined function on a model that i didnt even load on my report shell, how is this possible ??
thanks
NOTE: i have build the database along with the table (reports), the fields and entries, and i am manage to view the table entries using the browser.
I think that you’re trying to use custom mysql driver (for example, for debugging queries). You should change the driver name to ‘mysql’ in your /app/config/database.php. Or, if you still want to trace queries, you should create the /app/models/datasources/dbo/dbo_mysql_ex.php and put the code from here http://bin.cakephp.org/saved/32872 into it.