Download & Extend

Remove hook_product_transaction for simplicity

Project:e-Commerce
Version:6.x-4.x-dev
Component:ec_product
Category:task
Priority:normal
Assigned:Unassigned
Status:postponed

Issue Summary

Looking through the code I see calls like this: ec_product_invoke_productapi($item, 'transaction', 'delete'). Following the code I see it will call e.g. module_product_transaction($node, 'delete') where 'module' is the module that implement product of this type.

This looks like duplicated way of doing things, since modules that need this, can implement hook_transaction_delete() and loop through $txn->items array.

What are the use case for those hooks?

Can we remove them for sanity? I want to work on documenting hooks next, and IMO having several ways of doing the same thing is bad DX.

Comments

#1

I would like to say yes to this, but the main reason for doing this that you don't need to implement duplicate code to locate the items within every iteration of the these hooks.

However with the schema api you can now extend the ec_transaction_product table and these hooks start to become redundant.

Given that I seem to be talking myself into this. Can you submit a patch before just so I can see what is going to be changed. I will most likely give you the go ahead to commit it.

Gordon.

#2

Status:active» needs review

Ok, here's the patch. It remove hook_product_transaction($node, $op) where $op could be 'load', 'delete', 'update' or 'insert'.

AttachmentSizeStatusTest resultOperations
ec_hook_product_transaction.patch1.64 KBIgnored: Check issue status.NoneNone

#3

Status:needs review» postponed

Talked with Gordon in IRC and he said we should keep that for now and revisit in the next major version.

So changing to postponed.

nobody click here