Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Undocumented breaking change in 2.3.6 - \Magento\Sales\Model\Order\Pdf\Invoice class  #8299

Closed
@pixel-paul

Description

@pixel-paul

Summary (*)

After upgrading from 2.3.5-p1 to 2.3.6 an undocumented breaking change was introduced to the \Magento\Sales\Model\Order\Pdf\Invoice class. This prevents invoices from being printed if the class has been extended.

Ref: https://devdocs.magento.com/guides/v2.3/release-notes/backward-incompatible-changes/reference.html

Examples (*)

Before (2.3.5-p1):

public function __construct(
....
\Magento\Framework\Locale\ResolverInterface $localeResolver,
....

public function getPdf($invoices = []) {
..............
if ($invoice->getStoreId()) {
    $this->_localeResolver->emulate($invoice->getStoreId());
    $this->_storeManager->setCurrentStore($invoice->getStoreId());
 }
.........
if ($invoice->getStoreId()) {
    $this->_localeResolver->revert();
 }

After (2.3.6):

/**
* @var \Magento\Store\Model\App\Emulation
*/
private $appEmulation;

public function __construct(
....
\Magento\Store\Model\App\Emulation $appEmulation,
....

if ($invoice->getStoreId()) {
    $this->appEmulation->startEnvironmentEmulation(
    $invoice->getStoreId(),
     \Magento\Framework\App\Area::AREA_FRONTEND,
    true
    );
    $this->_storeManager->setCurrentStore($invoice->getStoreId());
}
......................
if ($invoice->getStoreId()) {
    $this->appEmulation->stopEnvironmentEmulation();
}

Because of this change and the introduction of a private function, extending this class has significantly changed.

Proposed solution

Ensure breaking changes are documented


  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions