Monday 15 September 2014

php - Yii - getting the attributes from a model -



php - Yii - getting the attributes from a model -

i have model has info set dynamically using following:

$array = array('user_id' => 12345); $model->setattributes($array);

but when run next on next line downwards returns null?

echo $model->user_id; // expect see 12345

can explain why null?

setattributes work on attributes have rules set on it. if there no rule set attribute user_id, need set under safe rule. related massive assignment.

php oop yii frameworks

No comments:

Post a Comment