简体   繁体   English

TYPO3 依赖注入与 mpdf/mpdf

[英]TYPO3 dependency injection with mpdf/mpdf

I'm currently upgrading a TYPO3 extension from v9 to v10 which uses mpdf/mpdf.我目前正在将 TYPO3 扩展从 v9 升级到使用 mpdf/mpdf 的 v10。

In Services.yaml I've addedServices.yaml我添加了

mPDF\:
  resource: '../../../../../vendor/mpdf/mpdf/'

But now I end up with this error message:但现在我得到了这个错误信息:

Expected to find class "mPDF\MpdfException" in file "/var/www/xxxx/vendor/mpdf/mpdf/MpdfException.php" while importing services from resource "../../../../../vendor/mpdf/mpdf/*", but it was not found.从资源“../../../../../”导入服务时,预期在文件“/var/www/xxxx/vendor/mpdf/mpdf/MpdfException.php”中找到 class“mPDF\MpdfException” vendor/mpdf/mpdf/*”,但没有找到。 Check the namespace prefix used with the resource.检查与资源一起使用的名称空间前缀。

The problem is, that the class is MpdfException and not mPDF\MpdfException .问题是, class 是MpdfException而不是mPDF\MpdfException

I tried to add我试图添加

MpdfException\:
  resource: '../../../../../vendor/mpdf/mpdf/'

This didn't work.这没有用。

Next I tried to add this to the global composer.json :接下来我尝试将其添加到全局composer.json

"autoload": {
  "psr-4": { "mPDF\\": "vendor/mpdf/mpdf/" }
}

but that didn't work either.但这也没有用。

Many thanks for your effort to help me, Julian.非常感谢你帮助我,朱利安。 Much appreciated.非常感激。 It turned out that the extension had a requirement for an outdated version of mPDF.事实证明,该扩展程序需要过时的 mPDF 版本。 After using the latest version of mPDF it now works.在使用最新版本的 mPDF 后,它现在可以工作了。 Nevertheless I still need Services.yaml .尽管如此,我仍然需要Services.yaml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM