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 Devtools issue

Hello!

I have a model Users that is extends class BaseModel. Currently in Devtools I'm trying to run a command:

phalcon model users --force

But every time I do this I'm getting an error:

Fatal error: Class `Models\BaseModel` not found in C:\ ...

What's wrong with me?



43.9k

Hi,

could you tell us wich line of wich file of devtools produce that error. That would be helpfull ...

Hi,

could you tell us wich line of wich file of devtools produce that error. That would be helpfull ...

file Users.php starts with

<?php

namespace Models;

use Phalcon\Validation;
use Phalcon\Validation\Validator\Uniqueness;

class Users extends BaseModel
{

that's it



43.9k

in command line:

phalcon model

output :


Options:
 --name=s             Table name
 --schema=s           Name of the schema [optional]
 --namespace=s        Model's namespace [optional]
 --get-set            Attributes will be protected and have setters/getters [optional]
 --extends=s          Model extends the class name supplied [optional]
 --excludefields=l    Excludes fields defined in a comma separated list [optional]
 --doc                Helps to improve code completion on IDEs [optional]
 --directory=s        Base path on which project is located [optional]
 --output=s           Folder where models are located [optional]
 --force              Rewrite the model [optional]
 --camelize           Properties is in camelCase [optional]
 --trace              Shows the trace of the framework in case of exception [optional]
 --mapcolumn          Get some code for map columns [optional]
 --abstract           Abstract Model [optional]
 --annotate           Annotate Attributes [optional]
 --help               Shows this help [optional]

so

phalcon model Users --namespace=Model --extends=BaseModel --force

could do the trick !



43.9k

and if ever your models are not in app/models but something like app/common/models, use the --output option

and if ever your models are not in app/models but something like app/common/models, use the --output option

Have already tried this

phalcon model Users --namespace=Models --extends=BaseModel --force

The path is common — /app/models

I've successfully created a lot of different models (more than 20 in my folder so far) but sadly I'm not able to update them.

Still getting the error:

Fatal error: Class 'Models\BaseModel' not found in C:\ ...app\models\Users.php on line 8


43.9k

I'e had a look at the latest devtools code, and I can't figure out from where that error could come from. I suggest you to open an issue on github.