Question

I've just moved my project that was created on Kohana3.3 from Windows to Ubuntu (local server), and it stopped working. I believe the problem is upper-/lowercase issues (it says for Table.__ or Model_ they don't exist).

I need some explanation about uppercase/lowercase file names and class names.

What I've found is SO question: Kohana 3.3 Not working from Subdirectory:

Kohana 3.3 adds partial support for the PHP Framework Interop Group's PSR-0 standard. PHP framework developers are encouraged to follow this standard to simplify interaction between frameworks. One of the requirements of PSR-0 is that the class names and file names match.

Also, I see the Controller folder in Kohana3.3 starts with a capital letter C (not as in 3.2). Also, Welcome.php file starts with W (not as in 3.2).

So, my simple questions for Kohana3.3 are:

Should the Model folder start with a capital letter?

Should all controller files start with a capital letter?

Should all model files in the Model folder start with a capital letter?

Should I write ORM::factory('Capital'), but not ORM::factory('capital')?

What about view folder: is it View or view?

I've read some examples for Kohana, but from what I've found I doubt it is for 3.3.

Also, my question: why did it work under Windows?

Was it helpful?

Solution

You can figure most of this out by simply reading the documentation and/or just experimenting and seeing what works and what does not work.

In short, in PSR-0 filenames must be exactly the same as the class name. So, if you call a class named Penguins_CanNot_Fly then the filename should be exactly Penguins/CanNot/Fly.php.

On Linux filenames are case sensitive. So, File.txt and file.txt are two different files. On Windows, however, the two files are considered to be the same file (this is because windows is case insensitive). This means that PSR-0 does not work properly on Windows, unless you modify the autoloader to check the exact file path.

As for the ORM, yes you need to keep in mind that models should be case sensitive. ORM::factory('Blog') and ORM::factory('blog') will load different models, but the same table will be used.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top