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

phalcon tools | undefined property Phalcon\config $dbname

when i want to create a model there were an error ;

Phalcon DevTools (1.1.0)

PHP Notice: Undefined property: Phalcon\Config::$dbname in C:\phalcon-tools\scr ipts\Phalcon\Builder\Model.php on line 332 PHP Stack trace: PHP 1. {main}() C:\phalcon-tools\phalcon.php:0 PHP 2. Phalcon\Script->run() C:\phalcon-tools\phalcon.php:82 PHP 3. Phalcon\Script->dispatch() C:\phalcon-tools\scripts\Phalcon\Script.php: 138 PHP 4. Phalcon\Commands\Builtin\Model->run() C:\phalcon-tools\scripts\Phalcon\ Script.php:115 PHP 5. Phalcon\Builder\Model->build() C:\phalcon-tools\scripts\Phalcon\Command s\Builtin\Model.php:85

SCREAM: Error suppression ignored for Notice: Undefined property: Phalcon\Config::$dbname in C:\phalcon-tools\scripts\ Phalcon\Builder\Model.php on line 332

Call Stack: 0.0014 657104 1. {main}() C:\phalcon-tools\phalcon.php:0 0.0209 1280336 2. Phalcon\Script->run() C:\phalcon-tools\phalcon.php:82

0.0210    1280864   3. Phalcon\Script->dispatch() C:\phalcon-tools\scripts\P

halcon\Script.php:138 0.0237 1284152 4. Phalcon\Commands\Builtin\Model->run() C:\phalcon-tool s\scripts\Phalcon\Script.php:115 0.0288 1523840 5. Phalcon\Builder\Model->build() C:\phalcon-tools\scrip ts\Phalcon\Commands\Builtin\Model.php:85

Error: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected

how can i solve it.



98.9k

Try changing dbname by name in your configuration file (app/config/config.php)



39.2k

im using ini file and its

[database] adapter = "Mysql" host = "127.0.0.1" username = "root" password = "" name = "aa"

and public/index.php

$di->set('db', function() use ($config) { return new DbAdapter(array( 'host' => $config->database->host, 'username' => $config->database->username, 'password' => $config->database->password, 'dbname' => $config->database->dbname )); });



98.9k

So, it must be:

[database]
adapter = "Mysql"
host = "127.0.0.1"
username = "root"
password = ""
dbname = "aa"


39.2k

So Thanks