Peter Kraume
Peter Kraume

Reputation: 3787

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.

Upvotes: 0

Views: 289

Answers (1)

Peter Kraume
Peter Kraume

Reputation: 3787

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.

Upvotes: 1

Related Questions