-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fix Dynamic Properties Deprecations in Order Objects. #222
Conversation
…der` class. This override is to account for additional properties required by the Square gateway that are not defined on the original class.
* | ||
* Runs on the hook 'woocommerce_order_class, 20'. | ||
* | ||
* @since x.x.x |
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.
Will need to be updated with version number prior to merge.
* | ||
* This class is used to add additional properties to the order object. | ||
* | ||
* @since x.x.x |
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.
As above
@@ -140,6 +140,36 @@ public function __construct() { | |||
add_action( 'action_scheduler_init', array( $this, 'schedule_token_migration_job' ) ); | |||
add_action( 'wc_square_init_payment_token_migration_v2', array( $this, 'register_payment_tokens_migration_scheduler' ) ); | |||
add_action( 'wc_square_init_payment_token_migration', '__return_false' ); | |||
|
|||
add_filter( 'woocommerce_order_class', array( $this, 'order_class' ), 20 ); |
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.
Is there a better location for this and the associated method?
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.
Not sure if you saw the previous PR but we originally took a similar approach to solve this in #20. I haven't compared this line by line but I think they are pretty similar. We ended up closing that out (and basically leaving the deprecation notices) due to the feedback we received. Can you can a look at that PR and the comments there to see if the approach here is different enough to try again on?
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.
@dkotter I'll take a look, I went looking yesterday but couldn't find it.
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.
I've reviewed James's comments on the original PR and the upstream tickets.
Given the concerns about a race to the bottom, I think we're blocked until it's addressed upstream. Probably in WC_Data
with either magic methods or a setter/getter for unsaved meta data.
Closing per comment on ticket and review above. |
All Submissions:
Changes proposed in this Pull Request:
Fixes and issue in which deprecation notices are thrown in PHP 8.2+ due to the use of dynamic properties.
WooCommerce\Square\WC_Order_Admin_Override_Square
to extendAutomattic\WooCommerce\Admin\Overrides\Order
to include the properties.WC_Order
andAutomattic\WooCommerce\Admin\Overrides\Order
.Closes #219 .
Steps to test the changes in this Pull Request:
Check the logs. Confirm there are no deprecation warnings for the creation of dynamic properties.
There may be some deprecation notices from Subscriptions relating to the use of
Automattic\WooCommerce\Admin\Features\Navigation
classes -- these are unrelated to this issue.Changelog entry