-
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
Update getCustomer method in order class #26423
Update getCustomer method in order class #26423
Conversation
Hi @sertlab. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Such change is not backward compatible, see https://devdocs.magento.com/guides/v2.3/contributor-guide/backward-compatible-development/
What problem are you trying to solve by such change?
I think this is related issue #25268 |
I tested and it returns only null. |
@sertlab it might return customer object in some specific case. |
Hi . @ihor-sviziev Tested with registered and logged in customer and getCustomer() still returns null in observer |
Yeah, this is expected behavior! Data object should just be a container for data, it should not contains any business logic, for example retrieving customer model. Fix actually should be just changing phpdoc block that method getCustomer could return null. In ideal situation would be great just remove it from that model at all, but I believe it will be treated as backward incompatible change, so let’s not do that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sertlab,
Could you rollback your changes in OrderInterface, Order classes and just update phpdoc block in Order model in order to highlight that it could return null?
@ihor-sviziev Hi. It's now updated as per your instructions |
Fix static test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failing functional & unit tests are not related to changes from this PR, so I'm approving this PR
Hi @ihor-sviziev, thank you for the review. |
✔️ QA passed |
Hi @sertlab, thank you for your contribution! |
Description (*)
Fixed Issues (if relevant)
Manual testing scenarios (*)
sales_order_save_after
eventExpected Result
A customer object should be returned
Actual Result
Null Returned
Questions or comments
Contribution checklist (*)