i am a bit confused about the preload ‘import’ parameters in ‘main.php’ config file. I have just change the import to:
// autoloading model and component classes
Now i have created a new folder in extension ‘validators’ and created a ‘uniqueValidator.php’ inside of validators. In the model i am adding the validator like:
array('year', 'CompositeUniqueKeyValidator', 'keyColumns' => 'year, user_id'),
and yii cant find this validator.
Now i set the alias path:
and now i can use the model like that:
array(‘year’, ‘validators.CompositeUniqueKeyValidator’, ‘keyColumns’ => ‘year, user_id’),
What is then preloder? And why it doesnt load all the files from extensions?
it does. but only from "extensions" directory, not subdirectories. If you want to automatically load classes from "validators" subdirectory you must add:
otherwise you could just type:
and everything would be loaded automatically…
Ok so in Yii case the " * " symbol doesnt mean that the files will be loaded recursive. But why then "application.*" loads all the files?
it does not. I just pointed that IF it worked then you would not have to specify any other paths like application.model., application.extensions., etc.
"*" in any case means only "all files from this directory" without recursion.