EaDesgin / magento2-pdf-generator2

Invoice PDF Generator For Magento 2
https://www.eadesign.ro/magento2-invoice-credit-memo-shipping-and-product-pdf-generator-pro.html
Apache License 2.0
67 stars 60 forks source link

Incompatibility with Magento 2.3.3 #91

Open csdougliss opened 5 years ago

csdougliss commented 5 years ago
Fatal error: Uncaught Error: Call to a member function setBodyAttachment() on null in /home/ccarnell/Sites/xx-uk2/vendor/eadesignro/module-pdfgenerator/Model/Email/TransportBuilder.php:16

This class has been refactored.

https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php

csdougliss commented 4 years ago

Any updates on this?

nobodyMO commented 4 years ago

hi, I had the same error. The reason is that magento has changed the email classes ... again. The message in the TransportBuilder class based now on EmailMessageInterface instead MessageInterface. https://community.magento.com/t5/Magento-DevBlog/Backward-incompatible-Changes-in-the-Mail-Library-for-Magento-2/ba-p/144787

I tried the patch (EmailMessageInterface backward compatibility issue patch for Magento 2.3.3 on https://magento.com/tech-resources/download#download2333) but the error was still the same. The reason is that the message property of the TransportBuilder object is not initialized than the addAttachment method is called. But also the initialization of that object solved the problem because the new EmailMessage was still incompatible with the use of the zend framework in the Message class of that module.

The way I solved the problem for me was to exchange the complete content of the TransportBuilder class to the version I found there: https://magento.stackexchange.com/questions/292760/unable-to-add-attachment-in-email-after-upgrade-to-magento-2-3-3-version

jaykobi commented 4 years ago

Thx, @nobodyMO, you just saved my day.

Dheeraj351 commented 4 years ago

@nobodyMO Thank you so much. I was trying from 6 hours, Implemented all ways to attach image with custom email but failed. Your comment saved me. Magento keep changing files. Anyway, Thanks a lot.

denvit commented 3 years ago

I've got the same problem with Magento 2.3.5-p2. @eadesignro do you plan to fix this soon?

SaturnusDJ commented 3 months ago

@nobodyMO Tagging you here as your forked repo does not have an issues tab. I added your repo as source in composer (composer config repositories.magento2-pdf-generator2 git git@github.com:nobodymo/magento2-pdf-generator2.git). Then I had to ignore requirements because installed PHP version is 8.2.x: composer require eadesignro/module-pdfgenerator --ignore-platform-reqs.

It shows up in the admin panel after all the Magento reload commands but doing anything gives this error:

main.ERROR: Deprecated Functionality: Creation of dynamic property Eadesigndev\Pdfgenerator\Model\Plugin\Config::$_url is deprecated in /bitnami/magento/vendor/eadesignro/module-pdfgenerator/Model/Plugin/Config.php on line 23 [] []

That is about https://php.watch/versions/8.2/dynamic-properties-deprecated. As non-programmer used ChatGPT to patch it but that didn't last long. 😬 Also, it did not look like https://youtu.be/-O4qhzL9_SM?t=883

Any plans on making your fork PHP 8.2 compatible?

nobodyMO commented 3 months ago

Hi SaturnusDJ, I only use my fork to keep the extension compatible with the Magento version used for our shop and the PHP version used. I don't currently have a development environment with PHP 8.2 and therefore can't test whether there are other problems with the changed PHP restrictions in the new version.

If I understand the message correctly, all attributes of classes must be declared explicitly in PHP8.2. This can be fixed relatively easily. Simply insert the following lines between lines 13 and 14:

/**
     * @var UrlInterface 
     */
public $_url;

However, it is possible that this is not the only missing declaration and that attributes must also be declared in other php files.

SaturnusDJ commented 3 months ago

@nobodyMO Thanks!! Fixed two of those errors with that. Afterwards there are new issues with Zend and module-email. For stability reasons and that certain functionality shown in the video is still not appearing, I will look at paid extensions now.