In https://github.com/Automattic/woocommerce-subscriptions-core/pull/304 we've introduced new cache managers that work with CRUD objects rather than post APIs, however because of class inheritance structures a lot of post related names have seeped into the new CRUD and HPOS compatible classes.
For this issue we should deprecate where necessary and update our inline comments, function and variable naming conventions to move away from post and postmeta nomenclature and refer to them as generic as some of them are no longer CPT specific and have been updated to work with CRUD objects instead.
Classes that should update:
WCS_Customer_Store_CPT - it now has both the post meta key (_customer_user) and data/property key ('customer_id'). Its name and references to posts should be updated and deprecated.
WCS_Customer_Store_Cached_CPT - this class has had elements of it change to support HPOS environments and so should also be updated to no longer refer to CPT. Inside this class there are also references to posts like in the function names maybe_update_for_post_meta_change and maybe_delete_all_for_post_meta_change.
🛑 WCS_Related_Order_Store_Cached_CPT - Blocked by https://github.com/Automattic/woocommerce-subscriptions-core/issues/339. Once that issue is closed, this related order cache will no longer be limited to CPT objects and so should have its name, functions and variables changed to reflect that.
WCS_Related_Order_Store_CPT - This class will still be used by the newly name WCS_Related_Order_Store_Cached_CPT (see above) and so also shouldn't refer to the CPT data type. Looking this classes code, there's nothing in here that is really CPT limited, it's completely CRUD and HPOS ready.
Expected behavior
These classes operated on CPT objects in the past, however because we've updated them to be compatible with HPOS environments their naming conventions no longer make sense. They should be updated to not confuse folks when using or developing on them.
Describe the bug
In https://github.com/Automattic/woocommerce-subscriptions-core/pull/304 we've introduced new cache managers that work with CRUD objects rather than post APIs, however because of class inheritance structures a lot of post related names have seeped into the new CRUD and HPOS compatible classes.
For this issue we should deprecate where necessary and update our inline comments, function and variable naming conventions to move away from post and postmeta nomenclature and refer to them as generic as some of them are no longer CPT specific and have been updated to work with CRUD objects instead.
Classes that should update:
WCS_Customer_Store_CPT
- it now has both the post meta key (_customer_user
) and data/property key ('customer_id'). Its name and references to posts should be updated and deprecated.WCS_Customer_Store_Cached_CPT
- this class has had elements of it change to support HPOS environments and so should also be updated to no longer refer to CPT. Inside this class there are also references to posts like in the function namesmaybe_update_for_post_meta_change
andmaybe_delete_all_for_post_meta_change
.WCS_Related_Order_Store_Cached_CPT
- Blocked by https://github.com/Automattic/woocommerce-subscriptions-core/issues/339. Once that issue is closed, this related order cache will no longer be limited to CPT objects and so should have its name, functions and variables changed to reflect that.WCS_Related_Order_Store_CPT
- This class will still be used by the newly nameWCS_Related_Order_Store_Cached_CPT
(see above) and so also shouldn't refer to the CPT data type. Looking this classes code, there's nothing in here that is really CPT limited, it's completely CRUD and HPOS ready.Expected behavior
These classes operated on CPT objects in the past, however because we've updated them to be compatible with HPOS environments their naming conventions no longer make sense. They should be updated to not confuse folks when using or developing on them.