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

Webtools

Hi again,

Thats happaning when i click models in webtools ... what that mean, what should I do ?

Phalcon\DI\Exception: Invalid service definition. Missing 'className' parameter

0 [internal function]: Phalcon\DI\Service\Builder->build(Object(Phalcon\DI\FactoryDefault), Array, NULL)

1 [internal function]: Phalcon\DI\Service->resolve(NULL, Object(Phalcon\DI\FactoryDefault))

2 /home/bender/vendor/phalcon/devtools/scripts/Phalcon/Web/Tools.php(161): Phalcon\DI->getShared('config')

3 /home/bender/vendor/phalcon/devtools/scripts/Phalcon/Web/Tools/controllers/ControllerBase.php(60): Phalcon\Web\Tools::getConfig()

4 /home/bender/vendor/phalcon/devtools/scripts/Phalcon/Web/Tools/controllers/ModelsController.php(30): ControllerBase->listTables(true)

5 [internal function]: ModelsController->indexAction()

6 [internal function]: Phalcon\Dispatcher->dispatch()

7 /home/bender/vendor/phalcon/devtools/scripts/Phalcon/Web/Tools.php(322): Phalcon\Mvc\Application->handle()

8 /home/bender/projects/minsp/public/webtools.php(26): Phalcon\Web\Tools::main('/home/bender/ve...', '192.168.')

9 {main}



12.2k

Hi. I have to make changes in webtools to make it work for me.

Please see changes below. Hope it will help you. Please pay attention to what config you got in webtools maybe you faced with this bug https://github.com/phalcon/phalcon-devtools/issues/222

diff --git a/scripts/Phalcon/Builder/Component.php b/scripts/Phalcon/Builder/Component.php
index 6a993a6..1dc5dc5 100644
--- a/scripts/Phalcon/Builder/Component.php
+++ b/scripts/Phalcon/Builder/Component.php
@@ -72,12 +72,13 @@ abstract class Component
         $directory = new \RecursiveDirectoryIterator('.');
         $iterator = new \RecursiveIteratorIterator($directory);
         foreach ($iterator as $f) {
-            if (preg_match('/config\.php$/i', $f->getPathName())) {
+               //var_dump($f->getPathName());
+            if (preg_match('/\/config\.php$/i', $f->getPathName())) {
                 $config = include $f->getPathName();

                 return $config;
             } else {
-                if (preg_match('/config\.ini$/i', $f->getPathName())) {
+                if (preg_match('/\/config\.ini$/i', $f->getPathName())) {
                     return new \Phalcon\Config\Adapter\Ini($f->getPathName());
                 }
             }
diff --git a/scripts/Phalcon/Builder/Scaffold.php b/scripts/Phalcon/Builder/Scaffold.php
index c00ae97..6edab78 100644
--- a/scripts/Phalcon/Builder/Scaffold.php
+++ b/scripts/Phalcon/Builder/Scaffold.php
@@ -170,7 +170,13 @@ class Scaffold extends Component
         $options['fileName'] = Text::uncamelize($options['className']);

-        $modelsNamespace = $options['modelsNamespace'];
+
+           if (!isset($options['modelsNamespace'])) {
+                   $modelsNamespace = $config->application->modelsNamespace;
+           } else {
+                   $modelsNamespace = $options['modelsNamespace'];
+           }
+
         if (isset($modelsNamespace) && substr($modelsNamespace, -1) !== '\\') {
             $modelsNamespace .= "\\";
         }
diff --git a/scripts/Phalcon/Web/Tools/controllers/ModelsController.php b/scripts/Phalcon/Web/Tools/controllers/ModelsController.php
index 3d441cb..269c2a7 100644
--- a/scripts/Phalcon/Web/Tools/controllers/ModelsController.php
+++ b/scripts/Phalcon/Web/Tools/controllers/ModelsController.php
@@ -60,7 +60,7 @@ class ModelsController extends ControllerBase
                     'foreignKeys'           => $foreignKeys,
                     'defineRelations'       => $defineRelations,
                     'genSettersGetters'     => $genSettersGetters,
-                    'namespace'             => null,
+                    'namespace'             => Tools::getConfig()->application->modelsNamespace,
                 ));

                 $modelBuilder->build();

thanks