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