R
R
raycheel2014-04-12 15:00:00
Yii
raycheel, 2014-04-12 15:00:00

Model name case issue in Yii. How to fix?

Hello! After transferring the Yii application to the hosting, a problem arose. When the framework starts loading model files, it looks for them in lowercase, (user, post, category), and for me they are written like this - User, Post, Category (as they should be written). What is the problem? How to decide?
An error like this:

include(user.php): failed to open stream: No such file or directory
When I rename the file from a capital letter to a small one, everything starts working.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
raycheel, 2014-04-12
@raycheel

The problem was in relations (relations), where the names of the models were indicated with a small letter.

S
Sergey, 2014-04-12
Protko @Fesor

Because in Windows, file paths are case insensitive. That is, the User.php file and user.php are the same file. But in UNIX-like systems, these will be two different files, and Yii, or rather its autoloader, looks for the User.php file (because the file name must match the name of the file being loaded).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question