UPD: CActiveRecord::getAttributes() returns attributes only based on DB columns, but my defined public properties on Model not shown.
I specified all properties in the rules as safe attributes.
How can I get them all?
UPD: CActiveRecord::getAttributes() returns attributes only based on DB columns, but my defined public properties on Model not shown.
I specified all properties in the rules as safe attributes.
How can I get them all?
In your model, override parents function getAttributes
public function getAttributes($names=true)
{
//get db columns first
$dbColumnsAttributes = parent::getAttributes($name);
// return your public properties with that
return $dbColumnsAttributes + array('you public properties');
}
The above code can bring your idea, do not copy directly.