I have object - instance of some class.
$obj = new SomeClass();
How I can use this object in all extended class in Yii?
I have object - instance of some class.
$obj = new SomeClass();
How I can use this object in all extended class in Yii?
Put your class in /protected/components folder and… use it where do you prefer =).
or by adding your class details to component section in config you can access it everywhere without creating the object every time.
// Config
'components'=>array(
'yourObj'=>array(
'class'=>'Yourclass',
),
),
// Accessing
Yii::app()->yourObj->yourMethod();
// You have to define init() method inside your class.And it should be there in components folder.