We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Table model doesn't exist in database when dumping meta-data for model

hi im keep getting the Table 'users' doesn't exist in database when dumping meta-data for Users error ive tried getSource{ return 'users' } and tried initialize (setSource) none of that options had worked and im still getting the same error message.

thx!



51.2k

It should be a spelling thing or maybe your table really doesn't exists in the selected database. You should execute a show tables command from mysql agains that database and compare it with your model.



1.5k
Accepted
answer

problem solved it was a missing config for db at config.php.

thanx!

I got the same error when on multi modules system through following commands : phalcon create-all-models --get-set --mapcolumn --directory apps\frontend\models In controller file along with this I got the error: $ForexRates = ForexRates::find(); print_r($ForexRates);

Got the error: Notice: Array to string conversion in C:\xampp\htdocs\testingtoday\apps\frontend\Module.php on line 78 Notice: Array to string conversion in C:\xampp\htdocs\testingtoday\apps\frontend\Module.php on line 78 Table 'forex_rates' doesn't exist in database when dumping meta-data for testingtoday\frontend\Models\ForexRates

And on following line changed the code : in testingtoday\apps\frontend Module.php

$di['db'] = function () use ($config) { // return new DbAdapter($config->toArray()); //}; To Replaces with : $di['db'] = function() use ($config) { // return new DbAdapter(array( "host" =>$config->database->host, "username" => $config->database->username, "password" => $config->database->password, "dbname" => $config->database->dbname )); };