In my application i want to add additional attribute to the owner model through its behaviours
I have a model to which a behaviour is attached i want to add attributes to that model form the behaviour
How to add additional attributes to the model from the attach($owner) method of behaviour
This is my attach method
//how can i add the code for adding additional attribute to the model
public function attach($owner)
{
$owner->metaData->addRelation( 'gallery', array(CActiveRecord::HAS_ONE, 'Gallery', 'principal_id') );
}
parent::attach($owner);
}
Page 1 of 1
How To Add Attribute To The Owner Model From Behaviour
#3
Posted 02 January 2013 - 11:02 AM
I'm not sure if you can add 'attributes' (assume properties). Why not just declare the properties in the model you are declaring the behavior in? (This is what I do).
#4
Posted 02 January 2013 - 11:37 AM
I should not be difficult since Yii is PHP. I would suggest you read the blog tutorial here is useful link might help you understand better
http://www.yiiframew...et-set-methods/
http://www.yiiframew...et-set-methods/
Share this topic:
Page 1 of 1

Help













