I am calling the findall method and i am getting 4 fields.I now want to add one more field named $owned.
SO that means after i get the record form the table, the resultant datarecord should contain the owned field.
Also the $owned field is dynamic based on whether user is the owner of the group. I tried using afterFind. But it is also not working. Surprisingly it is adding attributed owned to the object but not to attributes.
below is the code
/**
The followings are the available columns in table ‘group’:
@property integer $id
@property string $name
@property string $created_at
@property string $updated_at
*/
class Group extends CActiveRecord
{
//adding owned property for groups.true if user is owner
and i am not able to understand why the property $owned gets added to the top level of object tree…dosnt go to attributes at all…Upon doing CJSON::encode($model) i just dont see the property…
Hi Friends, Finally i found out. It is the problem with the CJSON::encode problem. this method only encodes the properties of the model. It doesn’t encode any relational or dynamic property. SO i wrote my own function and it works.!