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

Developer Tools Errors

Newbie to Phalcon. I have been a PHP developer for 5 years and after reading about Phalcon I am getting excited. I got Phalcon up and running no problem. I installed the Developer Tools no issue. But when I created a table in my database and then created a model I am getting an error. First it states that I success genegerated my model but just below that in the page are two nice bold errors. Here is what my page looks like:

Model "posts" was created successfully Edit Models

Name    Size    
( ! ) Fatal error: Uncaught exception 'UnexpectedValueException' with message 'DirectoryIterator::__construct(../app/models/,../app/models/): The system cannot find the path specified. (code: 3)' in C:\wamp\phalcon-tools\scripts\Phalcon\Web\Tools\views\models\list.phtml on line 23
( ! ) UnexpectedValueException: DirectoryIterator::__construct(../app/models/,../app/models/): The system cannot find the path specified. (code: 3) in C:\wamp\phalcon-tools\scripts\Phalcon\Web\Tools\views\models\list.phtml on line 23
Call Stack
#   Time    Memory  Function    Location
1   0.0057  254688  {main}( )   ..\webtools.php:0
2   0.0134  340448  Phalcon\Web\Tools::main( )  ..\webtools.php:26
3   0.0243  394760  handle ( )  ..\Tools.php:322
4   0.1034  656144  Phalcon\Mvc\View\Engine\Php->render( )  ..\Tools.php:0
5   0.1035  656864  __construct ( ) ..\list.phtml:23

I have not changed anycode beside my database info in my config.ini file. So all code was generated by the Developer Tools. I am using Windows 8, WAMP server, and I have my phalcon tools sitting in my WAMP folder. Can anyone help me with this error.

Thanks in advance! Darren



15.1k

Could you show me your project's config file?

edited Oct '14

Here is my config file:

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

[application]
controllersDir = ../app/controllers/
modelsDir      = ../app/models/
viewsDir       = ../app/views/
pluginsDir     = ../app/plugins/
libraryDir     = ../app/library/
cacheDir       = ../app/cache/
baseUri        = /phalconBlog/

[models]
metadata.adapter = "Memory"

This is the only file I made any changes to. Everything else was created from the Developer tools. Please let me know if you need anythinig else.

Thanks,

Darren



43.9k
edited May '14

maybe you should investigate why system complains with The system cannot find the path specified



15.1k

@le51 That's why I asked for the config file.

So the line that breaks is this:

$iterator = new DirectoryIterator($modelsDir);

Keeping in mind that DirectoryIterator takes only one parameter, and not two like on the stack trace - my guess would be that somehow value of $modelsDir is getting dodgy. I've never used the webtools, but maybe have a look if the same happens when you try to use the command line? if so, then we might get a better idea as to where to look next.

Yes, according to the error that is the line. Again I am brand new to Phalcon. So last night I just followed the install directions for installing Phalcon. Got that working. Then followed the instructions on how to install Developer Tools. Got that working no problem. Then I found a tutorial and wanted to use the webtools to see how the code was genereted so i can learn how to write it myself and not use webtools. But I cannot get webtools to work correctly without throwing errors. The thing is I did not write any of the code. All the code was generated by the webtools.The only change I made was in the config.ini file. I changed my local database credentials. So does anyone know if there is a bug in webtools. It is hard for me to find an error in Phalcon Developer Tools when I am brand new to Phalcon, I do not know it works and I did not write a line of code. I just want to get Webtools working so I can Learn How Phalcon works. Thanks,

Darren



15.1k
edited May '14

I've got to run now, but I will test the web tools in ~3 hours to see what's going on.

In the meantime, could you run the following comman in the root of your project (where you have app and public folderd)

php phalcon model posts --force
or
phalcon model posts --force

(depending on your configuration). Are those also giving you errors?

OK. I ran the code in the command line in the project folder and I got a Success message: SuccessL Model "posts" was successfully created.



15.1k

Ok, that's good. It means that the tools are working fine and it's just a bug with web stuff. I havent had time earlier, but I'll see if i can reproduce it tonight.



20.4k
edited Sep '14

I've got the same problem running in WAMP - created new project with with modules config.ini and webtools. The only change I have made is in config.ini to set DB connection. If I click on list controllers or list models I get Fatal error: Uncaught exception 'UnexpectedValueException' with message 'DirectoryIterator::__construct(../apps/frontend/controllers/,../apps/frontend/controllers/): The system cannot find the path specified. (code: 3)' in C:\wamp\phalcon-devtools\scripts\Phalcon\Web\Tools\views\controllers\list.phtml on line 23 If I try to create a new controller with webtools it says Unable to write to '../apps/frontend/controllers/\TestController.php'. How do I fix this?

al35mm,

Good Luck. I started this thread months ago and have no help. I gave up the idea and quit trying to learn Phalcon. Then I found a nice course on Phalcon PHP on Udemy and now I understand how I know Phalcon. The webtools is just something to help generate the code for you but it is better to learn how to code it. This will make you a better programmer and allow you to understand Phalcon better. Maybe one day we will figure out the issue with WebTools and it will work correctly.



20.4k

I started the Udemy course yesterday :) I started Phalcon a short time ago with the intention of porting a big project over - having a bit of dificulty getting into the Phalcon mindset. Up until now I have been coding from scratch and had developer tools mainly for the IDE stubs for Netbeans. Until now I hadn't discovered how useful dev tools could be - if it worked :)

al35mm,

I too need to take an old asp.net site written in vb 6 and port it over to a php framework. After about a month of researching php frameworks to build in I choose. Phalcon. I know both PHP and ASP.NET so learning Phalcon should not be too bad. I first bought the Phalcon book form Amazon and it uses the Web Tools to generate the CRUD code. So trying to follow along with the book and not having the Web Tools work correctly was a disappointment. So then I tried the forms to get help without any success. I then started looking else where at another PHP framework and decided to quit learning Phalcon. I then found the Udemy course and started learning Phalcon and I am glad that I did. Good Luck!



20.4k

Ha ha Redsoxfan, sounds like we have taken a very similar path. As well as the udemy course, I have ordered the book too and been reading the e-book version, which is how I ended up trying to use a broken dev tools just the same as you! I have a CodeIgnighter background, but I am finding Phalcon a little tricky to get into. I am persevering though as I think it should be worth it in the long term. Right now it's a bit frustrating though.

I've found the solution

In file C:\xampp\htdocs\phalcon-devtools-1.3.x\scripts\Phalcon\Web\Tools.php Line 217, comment out the

chdir('..');

on Line 229 & 237 change from

$cpath = $configPath . '/config.ini';

to

$cpath = '../'.$configPath . '/config.ini';

that works for me.

edited Sep '14

and for file C:\xampp\htdocs\phalcon-devtools-1.3.x\scripts\Phalcon\Builder\Controller.php line 63, change it to

        $path = '../';


60

What worked for me is modifying the default paths to the models, controllers, etc. in the config.ini file. Because my site setup is somewhat different from what Phalcon expects, I have to change all ../app/ occurences to app, for example: modelsDir = ../app/models/ changes into: modelsDir = app/models/