Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with Magento 2.3.3 #91

Open
csdougliss opened this issue Sep 25, 2019 · 8 comments
Open

Incompatibility with Magento 2.3.3 #91

csdougliss opened this issue Sep 25, 2019 · 8 comments

Comments

@csdougliss
Copy link

csdougliss commented Sep 25, 2019

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
Copy link
Author

Any updates on this?

@nobodyMO
Copy link

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
Copy link

jaykobi commented Mar 11, 2020

Thx, @nobodyMO, you just saved my day.

@Dheeraj351
Copy link

@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
Copy link

denvit commented Oct 6, 2020

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

@SaturnusDJ
Copy link

@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
Copy link

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
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants