简体   繁体   中英

TYPO3 dependency injection with mpdf/mpdf

I'm currently upgrading a TYPO3 extension from v9 to v10 which uses mpdf/mpdf.

In Services.yaml I've added

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. Check the namespace prefix used with the resource.

The problem is, that the class is MpdfException and not 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 :

"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. After using the latest version of mPDF it now works. Nevertheless I still need Services.yaml .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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