Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Phalcon DevTools #158

Open
harishletsgo opened this issue Sep 16, 2020 · 2 comments
Open

Support for Phalcon DevTools #158

harishletsgo opened this issue Sep 16, 2020 · 2 comments

Comments

@harishletsgo
Copy link

harishletsgo commented Sep 16, 2020

It seems like it is currently not possible to use the Phalcon DevTools (v4.0.3) on Vokuro by default without changing a whole lot. I wish there were an elegant solution to fix this.

$ phalcon controller test

Phalcon DevTools (4.0.3)

PHP Fatal error:  Uncaught Error: Call to undefined function Vokuro\root_path() in /Users/userx/Desktop/dev/vokuro/config/config.php:29
Stack trace:
#0 /Users/userx/phalcon-devtools/src/Builder/Path.php(64): include()
#1 /Users/userx/phalcon-devtools/src/Builder/Component/AbstractComponent.php(86): Phalcon\DevTools\Builder\Path->getConfig('ini')
#2 /Users/userx/phalcon-devtools/src/Builder/Component/Controller.php(57): Phalcon\DevTools\Builder\Component\AbstractComponent->getConfig()
#3 /Users/userx/phalcon-devtools/src/Commands/Builtin/Controller.php(63): Phalcon\DevTools\Builder\Component\Controller->build()
#4 /Users/userx/phalcon-devtools/src/Script.php(109): Phalcon\DevTools\Commands\Builtin\Controller->run(Array)
#5 /Users/userx/phalcon-devtools/src/Script.php(148): Phalcon\DevTools\Script->dispatch(Object(Phalcon\DevTools\Commands\Builtin\Controller))
#6 /Users/userx/phalcon-devtools/phalcon(64): Phalcon\DevTools\Script->run()
#7 {main}
  thrown in /Users/userx/Desktop/dev/vokuro/config/config.php on line 29

Fatal error: Uncaught Error: Call to undefined function Vokuro\root_path() in /Users/userx/Desktop/dev/vokuro/config/config.php on line 29

Error: Call to undefined function Vokuro\root_path() in /Users/userx/Desktop/dev/vokuro/config/config.php on line 29

Call Stack:
    0.0013     406208   1. {main}() /Users/userx/phalcon-devtools/phalcon:0
    0.0395    2867592   2. Phalcon\DevTools\Script->run() /Users/userx/phalcon-devtools/phalcon:64
    0.0397    2867592   3. Phalcon\DevTools\Script->dispatch() /Users/userx/phalcon-devtools/src/Script.php:148
    0.0405    2868928   4. Phalcon\DevTools\Commands\Builtin\Controller->run() /Users/userx/phalcon-devtools/src/Script.php:109
    0.0417    2898800   5. Phalcon\DevTools\Builder\Component\Controller->build() /Users/userx/phalcon-devtools/src/Commands/Builtin/Controller.php:63
    0.0418    2898720   6. Phalcon\DevTools\Builder\Component\Controller->getConfig() /Users/userx/phalcon-devtools/src/Builder/Component/Controller.php:57
    0.0418    2898720   7. Phalcon\DevTools\Builder\Path->getConfig() /Users/userx/phalcon-devtools/src/Builder/Component/AbstractComponent.php:86
    0.0435    2914856   8. include('/Users/userx/Desktop/dev/vokuro/config/config.php') /Users/userx/phalcon-devtools/src/Builder/Path.php:64

It might be possible to revert to BASE_PATH & APP_PATH. But is there a way to continue using the root_path function to run the devtool commands?

@yaskhan
Copy link

yaskhan commented Sep 22, 2020

Create in config folder config.ini file:

[database]
adapter  = Mysql
host     = localhost
username = root
password = rt85a_ch
dbname   = portal4

[application]
appDir         = src/
controllersDir = src/Controllers/
modelsDir      = src/Models/
migrationsDir  = db/migrations/
viewsDir       = themes/vokuro/
pluginsDir     = src/Plugins/
libraryDir     = src/library/
cacheDir       = var/cache/
baseUri        = /

[models]
metadata.adapter = "Memory"

then run devtools:

phalcon scaffold [tablename] --ns-models=Vokuro\Models --ns-controllers=Vokuro\Controllers --config=config\config.ini --template-engine=volt

@yaskhan
Copy link

yaskhan commented Sep 22, 2020

Add to file \vendor\phalcon\devtools\templates\scaffold\no-forms\Controller.php:

    public function initialize()
    {
        $this->view->setTemplateBefore('public'); // or 'private'
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants