Hi Friends,
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
public $owned;
protected function afterFind()
{
parent::afterFind();
//if user is owner of group its true
$this->owned = true;
}
Thanks to all
Smith
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
public $owned;
protected function afterFind()
{
parent::afterFind();
//if user is owner of group its true
$this->owned = true;
}
Thanks to all
Smith