We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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.2k
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);

?



964
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¿



964

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



43.8k

Hi,

mark post as solved !