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
Builder doesn't know where is the models directory #222
Comments
Devtools doesn't work either. Throws builder doesn't know where is the models directory... |
I had this problem when I created a project with webtools, but it was okay without webtools. It affected both webtools and the phalcon cli. The modelsDir location in app/config/config.php file was correct in both instances. I could avoid the error in the project directory by specifying the directory with $PWD or even just "." on the phalcon cli. So it seems to be an issue with finding the config directory when webtools has been installed. |
I just uninstalled webtools and then I could create the models again with phalcon cli: phalcon webtools --action=disable |
There is wrong regular expression in ~/phalcon-devtools/scripts/Phalcon/Builder/Component.php /**
* Tries to find the current configuration in the application
*
* @param $path
*
* @return mixed|\Phalcon\Config\Adapter\Ini
* @throws \Phalcon\Builder\BuilderException
*/
protected function _getConfig($path)
{
foreach (array('app/config/', 'config/') as $configPath) {
if (file_exists($path . $configPath . "config.ini")) {
return new \Phalcon\Config\Adapter\Ini($path . $configPath . "/config.ini");
} else {
if (file_exists($path . $configPath. "/config.php")) {
$config = include($path . $configPath . "/config.php");
return $config;
}
}
}
$directory = new \RecursiveDirectoryIterator('.');
$iterator = new \RecursiveIteratorIterator($directory);
foreach ($iterator as $f) {
//if (preg_match('/config\.php$/i', $f->getPathName())) { - Wrong expression
if (preg_match('/\/config\.php$/i', $f->getPathName())) {
$config = include $f->getPathName();
return $config;
} else {
if (preg_match('/\/config\.ini$/i', $f->getPathName())) {
return new \Phalcon\Config\Adapter\Ini($f->getPathName());
}
}
}
throw new BuilderException('Builder can\'t locate the configuration file');
} If do not fix that, than webtools.config.php file will match as config file. |
I download [ Phalcon 1.3.4 - Windows x86 for PHP 5.6.0 (VC11) ] this and download dev tools from [ https://github.com/phalcon/phalcon-devtools ] and create project with webdevtools and configure ip but my web interface of dev tools not working... give different errors like [database][adapter] ... and so on.... and some menu missing in web interface [ Configuration tab ] shown in video.... so what's the problem how can i fix it... could u please help me. I use php 5.6.3 and there is no config.ini file in app but DB config found it config.php |
for create ini-file use command create project: |
small changes /**
* Tries to find the current configuration in the application
*
* @param $path
*
* @return mixed|\Phalcon\Config\Adapter\Ini
* @throws \Phalcon\Builder\BuilderException
*/
protected function _getConfig($path)
{
foreach (array('app/config/', 'config/') as $configPath) {
if (file_exists($path . $configPath . "config.ini")) {
return new \Phalcon\Config\Adapter\Ini($path . $configPath . "/config.ini");
} else {
if (file_exists($path . $configPath. "/config.php")) {
$config = include($path . $configPath . "/config.php");
return $config;
}
}
}
$directory = new \RecursiveDirectoryIterator('..');
$iterator = new \RecursiveIteratorIterator($directory);
foreach ($iterator as $f) {
if (preg_match('/\/config\.php$/i', $f->getPathName())) {
$config = include $f->getPathName();
return $config;
} else {
if (preg_match('/\/config\.ini$/i', $f->getPathName())) {
return new \Phalcon\Config\Adapter\Ini($f->getPathName());
}
}
}
throw new BuilderException('Builder can\'t locate the configuration file');
} |
Builder can't locate the configuration file -- i can not identify it... why and where it comes from when i try to create controllers or model... above 2 suggestion i applied but still this problem going on |
Hi Guys Just ran into this myself. This problem is not with Component.php (it would seem like it, because it is always returning 1). I added a debug message to check what Component was doing. This is the result
As you can see from this, it is checking for the wrong directory. It gets that from $path, which is set in Models.php The wrong $path is set in Models.php on line 240 It looks like this $path = '';
if (isset($this->_options['directory'])) {
if ($this->_options['directory']) {
$path = $this->_options['directory'] . '/';
}
} else {
$path = '.';
} There is a missing slash in the last "else" block. When you add the slash everything works if (!$this->_options['name']) {
throw new BuilderException("You must specify the table name");
}
$path = '';
if (isset($this->_options['directory'])) {
if ($this->_options['directory']) {
$path = $this->_options['directory'] . '/';
}
} else {
$path = './';
} New debug after slash was added:
|
LOL. |
none of the above solution works properly sad :( |
I'll try today |
👍 |
@javagrails Can you please try with 2.0.x branch? Probably I fixed this issue earlier |
I get this error trying to generate models, although I can generate controllers O.o
That error I get when I try to generate ALL models, and when I try to generate only one, I get
Database configuration cannot be loaded from your config file
v 1.3.1
btw I'm using config as php, generated from devtools.
EDIT: Okay, there has to be something wrong with permissions and users. All the files created by webtools are owned by
‒
O.o Any thoughts about how to handle this ?The text was updated successfully, but these errors were encountered: