CMSページの場合と同様のインライン編集アクションを含む独自のCRUDモジュールを作成しました。
すべてが正常に動作しますが、EcgM2標準で phpsnifferを実行すると、次の警告が表示されます。
ループで検出されたモデルLSDメソッドsave()
どうすればこれを回避できますか?
注:上記のリンクされたコアファイルを「スニッフィング」すると、同じ警告が表示されます。
ここにexecute誰かがそれを必要とする場合の私の方法があります。しかし、それはCMSページコントローラーからのものと非常に似ています
public function execute()
{
    /** @var \Magento\Framework\Controller\Result\Json $resultJson */
    $resultJson = $this->jsonFactory->create();
    $error = false;
    $messages = [];
    $postItems = $this->getRequest()->getParam('items', []);
    if (!($this->getRequest()->getParam('isAjax') && count($postItems))) {
        return $resultJson->setData([
            'messages' => [__('Please correct the data sent.')],
            'error' => true,
        ]);
    }
    foreach (array_keys($postItems) as $authorId) {
        /** @var \Sample\News\Model\Author $author */
        $author = $this->authorRepository->getById((int)$authorId);
        try {
            $authorData = $this->filterData($postItems[$authorId]);
            $this->dataObjectHelper->populateWithArray($author, $authorData , AuthorInterface::class);
            $this->authorRepository->save($author);
        } catch (LocalizedException $e) {
            $messages[] = $this->getErrorWithAuthorId($author, $e->getMessage());
            $error = true;
        } catch (\RuntimeException $e) {
            $messages[] = $this->getErrorWithAuthorId($author, $e->getMessage());
            $error = true;
        } catch (\Exception $e) {
            $messages[] = $this->getErrorWithAuthorId(
                $author,
                __('Something went wrong while saving the author.')
            );
            $error = true;
        }
    }
    return $resultJson->setData([
        'messages' => $messages,
        'error' => $error
    ]);
}