This method provides a convenient shortcut for:
php
if (isset($_POST['FormName'])) {
$model->attributes = $_POST['FormName'];
if ($model->save()) {
handle success
}
}
which, with
load() can be written as:
php
if ($model->load($_POST) && $model->save()) {
handle success
}
load() gets the
'FormName' from the model's
Model::formName method (which you may override), unless the
$formName parameter is given. If the form name is empty,
load() populates the model with the whole of
$data,
instead of
$data['FormName'].
Note, that the data being populated is subject to the safety check by
Model::setAttributes.