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
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityLSD 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
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);