Skip to content

Customer getOrigData not available in customer_save_after #8788

@cykirsch

Description

@cykirsch

This issue was referenced in #4662 but it has been abandoned twice and closed once, and it still does not work in current versions. @slavvka mentioned back in October (#4662 (comment)) that it may be fixed already and should be backported to 2.1 soon. If true, how can I test against that fixed version, and when can I expect to see it in 2.1?

Preconditions

  1. Magento 2.1.5

Steps to reproduce

  1. Create a test module with the following files (plus Vendor/Module/etc/module.xml and Vendor/Module/registration.php)

Vendor/Module/etc/events.xml

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="customer_save_after">
        <observer instance="Vendor\Module\Observer\Customer" name="vendor_module_observer_customer"/>
    </event>
</config>

Vendor/Module/Observer/Customer.php

<?php

namespace Vendor\Module\Observer;

class Customer implements \Magento\Framework\Event\ObserverInterface
{
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $customer = $observer->getEvent()->getCustomer();
        var_dump($customer->getOrigData());
        exit;
    }
}
  1. Edit a customer on either the website or the admin.
  2. Click save.

Expected result

  1. Output unmodified (origData) customer data to the screen, followed by transaction rollback error.

Actual result

  1. Output NULL to the screen, followed by transaction rollback error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasetriage wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions