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

Error when try to create a model

Hi guys, i am new to phalcon. when i try to create a new model with dev-tools, i got an error:

E:\phpenv\htdocs\wuzi_phalcon>phalcon model users

Phalcon DevTools (2.0.1)

PHP Fatal error: Call to undefined function Phalcon\Builder\real_path() in E:\p hpenv\htdocs\phalcon-devtools\scripts\Phalcon\Builder\Model.php on line 250

Fatal error: Call to undefined function Phalcon\Builder\real_path() in E:\phpenv \htdocs\phalcon-devtools\scripts\Phalcon\Builder\Model.php on line 250

How to fix this error? System: Win XP php: 5.4 (xampp) phalcon: 2.0.1 dev-tools:2.0.1

i have just created a new project, then created a new controller, then when i try to create a model, this error happened.

thanks for helps!



25.4k
Accepted
answer

do you create your config file: on: app/config/config.php

    <?php

use Phalcon\Config;

$settings = array(
    "database" => array(
        "adapter" => "Mysql",
        "host" => "localhost",
        "username" => "root",
        "password" => "280510",
        "name" => "feedback",
    )
);
return $config = new Config($settings);

?



967
edited May '15

thanks Hugo. And yes, it is the config file:

<?php

return new \Phalcon\Config(array(
    'database' => array(
        'adapter'     => 'Mysql',
        'host'        => 'localhost',
        'username'    => 'root',
        'password'    => 'pwd123456',
        'dbname'      => 'wuzi',
        'charset'     => 'utf8',
    ),
    'application' => array(
        'controllersDir' => __DIR__ . '/../../app/controllers/',
        'modelsDir'      => __DIR__ . '/../../app/models/',
        'viewsDir'       => __DIR__ . '/../../app/views/',
        'pluginsDir'     => __DIR__ . '/../../app/plugins/',
        'libraryDir'     => __DIR__ . '/../../app/library/',
        'cacheDir'       => __DIR__ . '/../../app/cache/',
        'baseUri'        => '/wuzi/',
    )
));

i think your problem is withe the path for folders , in this case model,

controllersDir = ../app/controllers/
modelsDir      = ../app/models/
viewsDir       = ../app/views/
pluginsDir     = ../app/plugins/
libraryDir     = ../app/library/
cacheDir       = ../app/cache/
baseUri        = /phalconBlog/

is multi module project or standar mvc¿



967

thanks Hugo. i download new dev-tools, and this error fixed. thank you.



43.9k

Hi,

mark post as solved !