Revision #6 has been created by Kartik V on Jan 20, 2016, 7:46:10 AM with the memo:
Added Comments
« previous (#5) next (#7) »
Changes
Title
unchanged
Handling tabular data loading and validation in Yii 2
Category
unchanged
Tutorials
Yii version
unchanged
Tags
unchanged
yii, yii2, tabular, data, multiple, record, submission, validation, save
Content
changed
[...]
public function actionBatchUpdate()
{
// retrieve items to be updated in a batch mode assuming each item
// is of model class 'Item'.
// Note the getItemsToUpdate method is an example method, where you
// fetch the valid models to update in your tabular form. You need
// to write such a method OR directly call your code to get the models.
$items=$this->getItemsToUpdate();
if (Model::loadMultiple($items, Yii::$app->request->post()) &&
Model::validateMultiple($items)) {
$count = 0;
foreach ($items as $item) {[...]