-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
How to fix magento compatibility issue in both version 2.3 & 2.4 #30684
Comments
Hi @sucharita-ksolves. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. Please, add a comment to assign the issue:
🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
Hi @krishprakash. Thank you for working on this issue.
|
Hi @sucharita-ksolves. Thank you for your report. |
Yeah, that change was a pretty bad one not done in a backwards compatible way. We had the same problem with one of our modules after upgrading from Magento 2.3.5 to 2.3.6 Our solution - and it's probably going to be frowned upon - was to remove the constructor and use the For example, use something like this to instantiate <?php
...
use Magento\Framework\App\ObjectManager;
use Magento\Sales\Model\Order\Pdf\Invoice as InvoicePdfModel;
...
class Whatever extends InvoicePdfModel
{
private $someClassInstance;
private function getSomeClassInstance()
{
if ($this->someClassInstance === null) {
$this->someClassInstance = ObjectManager::getInstance()->get(SomeClass::class);
}
return $this->someClassInstance;
}
....
} |
For modify sales pdf design , I have overwrite pdf model file (module-sales/Model/Order/Pdf/Invoice.php, module-sales/Model/Order/Pdf/Shipment.php ,
As magento 2.3 and 2.4 version __construct function changed, so When I overwrite it will not work both version. How can I fix it ,so it will work in both version with same code.
The text was updated successfully, but these errors were encountered: