Skip to content

sales_order_state_change_before Event should give access to order object #26789

Closed
@simonrl

Description

@simonrl

Summary

When placing an observer on sales_order_state_change_before, it's not possible to get any data from the actual order object.

Examples

see \Magento\Sales\Model\Service\OrderService->setState():

Current code is:
$this->eventManager->dispatch( 'sales_order_state_change_before', ['order' => $this, 'transport' => $transport] );

Because $this is passed to the observer, and not $order, there's no way to get order data in the observer.

Proposed solution

Change event dispatch either to 'order' => $order, or add 'order_object' to have it backwards compatible.

$this->eventManager->dispatch( 'sales_order_state_change_before', ['order' => $this, 'transport' => $transport, 'order_object' => $order] );

Metadata

Metadata

Assignees

Labels

Issue: ready for confirmationPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itstale issue

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions