SystemicPlural, on 21 July 2010 - 07:32 AM, said:
Note that this will import the directory components/myClass/*
. If you only want your classfile it's enough to use Yii::import('application.components.myClass');
. But that's probably also obsolete as you already will have Yii::import('application.components.*');
in your config.
Can I lazy load these and access them through Yii::app()-> in some way?
I guess I need to put something in the config, in the components section. But I am not sure what.
Sure, you can configure custom application components. It's best to extend these from CApplicationComponent. Then configure it like this:
It will be available with Yii::app()->somename
and only be instantiated on first access of this property.