按照国际惯例,打开
/vendor/magento/framework/Exception/NoSuchEntityException.php
添加更具体的异常抛出
原代码为:
public function __construct(Phrase $phrase = null, \Exception $cause = null, $code = 0) { if ($phrase === null) { $phrase = new Phrase('No such entity.'); } parent::__construct($phrase, $cause, $code); }
修改添加后为:
public function __construct(Phrase $phrase = null, \Exception $cause = null, $code = 0) { foreach (debug_backtrace() as $_stack) { echo ($_stack["file"] ? $_stack["file"] : '') . ':' . ($_stack["line"] ? $_stack["line"] : '') . ' - ' . ($_stack["function"] ? $_stack["function"] : ''); } // exit(); if ($phrase === null) { $phrase = new Phrase('No such entity.'); } parent::__construct($phrase, $cause, $code); }
直接输入错误的文件位置,方便排错。
然后惊喜地发现是quote引用问题,进数据库清空Quote_item表,
还有其它的错误?
No such entity with customerId = 3