Reputation: 6466
How do you generate a model with multiple names without creating a sub directory?
The following:
oil g model test_test name:string
Creates:
Creating model: /web/dev/fuel/app/classes/model/test/test.php
Creating migration: /web/dev/fuel/app/migrations/010_create_test_tests.php
But I want to create:
Creating model: /web/dev/fuel/app/classes/model/test_test.php
Creating migration: /web/dev/fuel/app/migrations/010_create_test_tests.php
Thanks,
Rich
Update
I have been informed that you cannot use underscores in a FuelPHP classname, that the autoloader will not load it if you do. So, I guess the question is:
What is the correct naming convention for a FuelPHP class with multiple words? And is that naming convention expressible using oil?
Update 2
The FuelPHP Coding Standards (http://docs.fuelphp.com/general/coding_standards.html) has the following sentence:
The use of camelcase is discouraged but cannot be prevented in some cases when putting the class in a subdirectory makes no sense.
The sentence seems to accept the possibility that camel case maybe used in some cases, but I cannot believe that a class name with multiple words is such a fringe scenario.
Upvotes: 0
Views: 602
Reputation: 484
It's in the coding conventions:
Class names should use underscores to separate words, and each word in the class name should begin with a capital letter. An underscore will, however, be converted to a directory separator during autoloading. The use of camelcase is discouraged but cannot be prevented in some cases when putting the class in a subdirectory makes no sense.
Or as we put it in the coding conventions for 2.0 (work in progress) a bit more to the point:
Class names should use a combination of PascalCase and underscore separated words. Underscores are turned into directory separators in the autoloader, and should always be meaningful. Don't use them as word separator, when you need multiple words to describe the class PascalCase should be used.
Upvotes: 1