Yii Can't Autload A Model/class

Dear Yiians,

I’m getting a pretty weird behavior from my Yii project. Everything was OK then suddenly the project stopped to autload a specific model: SystemParameters.php

It was working for at the least 15 days.

I use such model to bring the parameters and constants used in the project. The reason it’s an table and not under enumerators or CONSTANT is because the user needs to change every month.

The workaround I’ve found was to add:

require_once APPLICATION_PATH . DS . ‘models/SystemParameters.php’;

Any clue of what I’m doing wrong?

PS: yes, my config/main.php includes ‘import’=>array(‘application.models.*’, and NO, is not a sensitive case.

Thank you for any help,

Doug.

Hi Doug

Are you sure that nothing changed in your database (including case-sensitive names of database tables)

Did your mysql (or php)upgraded by your server provider?

Does your site works on localhost ?

Thanks for the help, Kon.

I use Firebird (YiiFirebird extension) and not Postgres. Firebird is case insensitive. And no, I didn’t change anything on the database.

I’ve generated a model using Gii again, but still not autoloading. Same result.

And if I take off the line "require_once" I get the following error:

Fatal error: Class ‘SystemParameters’ not found in /Users/doug/local.WebDevelopment/my-yii-project/protected/controllers/SystemParametersController.php on line 149

I had to add a line on the views too:

require_once APPLICATION_PATH . DS . ‘models/SystemParameters.php’;

I use mac OS X (localhost), but it started in the server, which is linux. Not tested in Windows. Both linux and OS X claim that. The weird thing is all the other models should give the same error…

Doug.

Ok, lets try something.

Create a new database with same tables schema (without records)

switch your connection to the new database (config/main.php)

If the error persists, make a new app only with necessary controller/model to trace and re-product the error

Let inform us!

[i][b]"Create a new database with same tables schema (without records)"

[/b][/i]

I did. Same results.

switch your connection to the new database (config/main.php)

I did. Same results.

[i][b]If the error persists, make a new app only with necessary controller/model to trace and re-product the error

[/b][/i]

It works. It finds the model using both databases/connections.

Any clue of what I’ve [or gii/yii has] done? >:(

Compare the controllers / models between two applications for each code line, do you find any differences?

you use the same databases so the problem should be find in different code

what did you find ?

This is the weird thing. There is nothing different. It was working 15 days ago. I’m supposing that find the file in the SO is job of PHP, which uses Apache API/engines. So, Yii and the database should nothing related in the fact PHP can’t find a file itself.

I’ve checked .htacess and files/directories permissions. could be a goblin?