uc_order_product_save() is a two-line function that is only called from two places, it can just be inlined and removed.

Comments

longwave created an issue.

TR’s picture

There are a number of other procedural functions in uc_order.module that would also be good to remove and replace with methods on the Order entity or OrderProduct entity. With of course the corresponding method defined on the entity interface.

For example,

uc_order_comment_save() => Order::addComment()
uc_order_comments_load() => Order::getComments()

uc_order_product_save() => OrderProduct::save()
uc_order_product_revive() => I don't even know what this is for ... I suspect we don't need it if we carry around entities rather than arrays/stdClasses pretending to be products.

uc_order_product_is_shippable() => OrderProduct::isShippable()

uc_order_state_options_list() => Order::getStates()
uc_order_state_default() => Order::getDefaultStatus()
uc_order_actions() => Order::getActions()

longwave’s picture

I think uc_order_actions() should be converted to EntityListBuilderInterface::getOperations(), then we can get rid of the custom Views field as well.