我试图在自定义模块中与Magento框架一起使用Amphp并行函数。
try {
$response = wait(parallelMap($items, function ($item) use ($arg1){
$this->getCustomItems( $item, $arg1);
}));
} catch (MultiReasonException $exception) {
foreach ($exception->getReasons() as $reason) {
var_dump($reason->getMessage());
}
}当运行上述代码时,我遇到的问题是
Uncaught RuntimeException in worker with message "ObjectManager isn't initialized" and code "0"; use Amp\Parallel\Worker\TaskFailureException::getOriginalTrace() for the stack trace in the workerMagento框架使用composer自动加载。所以我不知道为什么它不能初始化对象管理器。
发布于 2022-06-23 12:48:57
Magento的依赖项与autoload一起自动加载,但是如果Magento内核没有初始化它,则需要创建单独的Magento API,并通过在供应商/autloload.php中编写的回调方法(使用CURL请求)请求API,这是如何使用amphp的。
https://stackoverflow.com/questions/71122221
复制相似问题