Each entity type has a custom storage class with custom load methods, but they've grown apart over time. Let's make sure they're named consistently. The first step was #2906026: Rename PaymentStorage::loadMultipleForOrder to loadMultipleByOrder.
Incomplete list:
PromotionStorage: loadAvailable() -> this method accepts an $order_type and $store. The order type is loaded for no reason, we only need its ID. Pass it the full order instead, which leaves room for expansion in the future (using the order's placed date, for example).
LogStorage::loadByEntity -> needs to be loadMultipleByEntity().
CouponStorage::loadByCode -> should be loadEnabledByCode. We can also add a separate pure loadByCode().
Debatable: PaymentGatewayStorage::loadMultipleForOrder($order) sounds better as loadApplicable($order) but I'm worried that loadForUser($account) then makes less sense.
Comment | File | Size | Author |
---|---|---|---|
#5 | interdiff-3-5.txt | 4.2 KB | czigor |
#5 | commerce-2906218-storage_load_method_cleanup-5.patch | 28.95 KB | czigor |
Comments
Comment #2
czigor CreditAttribution: czigor at Centarro commentedLet's see what the testbot thinks about this one.
Comment #3
czigor CreditAttribution: czigor at Centarro commentedFixing docblock.
Comment #4
bojanz CreditAttribution: bojanz at Centarro commentedat a glance, it looks like you didn't update the @params in the docblock?
We should not be making this change. Context is not a field on the variation, so the By rule doesn't make sense
Comment #5
czigor CreditAttribution: czigor at Centarro commentedAddressed the issues above.
Comment #7
bojanz CreditAttribution: bojanz at Centarro commentedThanks!