Questions tagged «save»

1
避免在大规模动作中循环保存
我创建了自己的CRUD模块,其中包含类似于CMS页面的内联编辑操作, 一切正常,但是以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 …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.