Hi,
I want to add dynamic attributes to a model. Say my table has 3 fields(id,groupname,ownerId).I have added one more property to the model named isOwner.This property is not in th model table.
After i fetch all records related to the user(say userID =1), i have to attach one more property isOwner.This property should be 1 if the user is the owner of group and 0 if he is not.
I declared a public property, public $isOwner to my model class. I created a function to find if user is owner.Now i want isOwner property to be 1 for every record i fetch using findAll() function. I used the afterFind() function also but its not working.?
Any ideas?
This is in continuation to the topic
http://www.yiiframework.com/forum/index.php/topic/38617-add-attributes-after-finall-function-in-model/page__p__185700__fromsearch__1#entry185700
Thanks to all
I want to add dynamic attributes to a model. Say my table has 3 fields(id,groupname,ownerId).I have added one more property to the model named isOwner.This property is not in th model table.
After i fetch all records related to the user(say userID =1), i have to attach one more property isOwner.This property should be 1 if the user is the owner of group and 0 if he is not.
I declared a public property, public $isOwner to my model class. I created a function to find if user is owner.Now i want isOwner property to be 1 for every record i fetch using findAll() function. I used the afterFind() function also but its not working.?
Any ideas?
This is in continuation to the topic
http://www.yiiframework.com/forum/index.php/topic/38617-add-attributes-after-finall-function-in-model/page__p__185700__fromsearch__1#entry185700
Thanks to all