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

Problem with DevTools (model & scaffold) - "Cannot redeclare class Phalcon\Config"

Hi all!

I have installed Phalcon DevTools via composer. Then, I created my project via DevTools and I completed the file config.php with mysql's informations. The website works fine.

But, if I try use DevTools with command model or scaffold, I got this error :

PHP Fatal error: Cannot redeclare class Phalcon\Config in /home/www/project/vendor/phalcon/devtools/ide/0.5.0/Phalcon/Config.php on line 29

For information, my versions are :

  • PHP 5.4.30
  • Phalcon 1.3.2
  • Phalcon DevTools 1.3.2

    Thanks for your help.



98.9k

This probably means someway IDE stubs are being included instead of using the PHP extension.



2.1k

Thank for you response.

But how I do to disabled IDE stubs includes?

For information, if I change my config.php file with wrong informations, DevTools says me that config is not correct, so that works.



98.9k

I'm not sure where it is exactly including the IDE stubs, what IDE are you using?



2.1k

I'm not using IDE. phalcon scaffold command is using directly in my terminal.



2.1k

A lead : it doesn't work because vendor folder is in the phalcon project folder (with app, public...) If I put vendor folder in the parent directory, it works.

Do you know how I can modify devtools for keep vendor folder in the same directory as app folder ?

Thanks



2.1k
Accepted
answer

I have my answer. If vendor folder is in the phalcon project folder, we have to do :

phalcon scaffold tablename --directory=

instead of

phalcon scaffold tablename