0

I am getting a warning as a "Model LSD method save() detected in the loop" when I did MEOP2"

The issue is on below the line

$model->setData($finalData)->save();

Please anyone can help me to resolve this issue

Thank you in advance

0

LSD comes from load/save/delete as Marius says in his answer here: Magento 2: MassAction Model LSD method delete()

Try to avoid saving data inside a loop

2
  • Hi @SantiBM Thank you,It's working for me.
    – rakhi
    Jun 4 '19 at 9:53
  • Great! mark the answer as correct if it was helpful!
    – SantiBM
    Jun 4 '19 at 10:46
0

Try to avoid save function inside the loop.

Try the below code

private function saveItem($model, $finalData)
{
    $model->setData($finalData)->save();
}

and replace the line $model->setData($finalData)->save(); with

$this->saveItem($model, $finalData);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.