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

Generating Models in a Multi Module project with the dev-tools

When I try to create automatically the model from the database with the dev toos I receive a bunch of errors saying that it couldn't locate the config.php file. I am in a multi module project and the what for what I saw, the problem is that the dev-tool script is trying to find the config files as it was in a simple module project. Is it possible to overcome this? I mean is there a parameter that says that the project is a multi module?



98.9k

Currently, Phalcon Devtools does not support generate models for multi-module applications.



51.1k

What do you mean it does not support ? Or I don't understand the question ? All my applications are multi module and every time i need to generate models I execute for example:

phalcon model user --schema test --get-set --doc --mapcolumn --namespace App\\Core\\Models\\User --directory apps/core/

This will generate models in apps/Core module

phalcon model user --schema test --get-set --doc --mapcolumn --namespace App\\Backoffice\\Models\\User --directory apps/backoffice/

This will generate models in apps/backoffice module

And it is very important that in your /module folder to have a folder config (lowercase) that contains a file config.php with the config params for that module. If your config folder is not lowercase, you can edit the file in devtools and add it.

the code is really too long , haha.

What do you mean it does not support ? Or I don't understand the question ? All my applications are multi module and every time i need to generate models I execute for example:

phalcon model user --schema test --get-set --doc --mapcolumn --namespace App\\Core\\Models\\User --directory apps/core/

This will generate models in apps/Core module

phalcon model user --schema test --get-set --doc --mapcolumn --namespace App\\Backoffice\\Models\\User --directory apps/backoffice/

This will generate models in apps/backoffice module

And it is very important that in your /module folder to have a folder config (lowercase) that contains a file config.php with the config params for that module. If your config folder is not lowercase, you can edit the file in devtools and add it.

i think his meaning is that phalcon webtools does not support .

so many code is too laughing , copy a new model and modify it , which is simple ?