Closed (fixed)
Project:
Commerce Reporting
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
26 Oct 2017 at 02:51 UTC
Updated:
16 Feb 2018 at 03:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
chrisrockwell commentedComment #3
chrisrockwell commentedI may be over-thinking this, but I'm wondering if we shouldn't have the only base fields be: order_id, created. Then we would have a CommerceOrderReport bundle plugin "OrderReport" that would add the amount field.
This may be a result of my lack of knowledge re: bundle plugins, but if we don't do it that way, would every other CommerceOrderReport bundle plugin also have to save the amount (which it may or may not be interested in)? And then it wouldn't be so easy to add additional order specific fields in the future (not sure what those are, just brainstorming).
Comment #4
chrisrockwell commentedBrings in #2918883: Remove tax_amount and shipping_amount from OrderReport base field definitions and #2918884: OrderPlacedEventSubscriber should pass initialized order report to report plugins, add a bundle plugin manager.
Right now we have only order id and created on the OrderReport entity.
Plugin\Commerce\OrderReportType\OrderReport.phpadds the amount field.With this patch the very basic report is generated on order place.
Comment #5
chrisrockwell commentedComment #6
mglamanI think that's valid. I just wasn't sure if each would want order total information. But, again. That's just a JOIN away!
Comment #7
mglamanI notice here it's `commerce_order_report_type`.
We should probably just call it `commerce_report_type`. We know all reports are based off of order data.
Comment #8
chrisrockwell commentedMakes sense. Is it safe to assume that would apply everywhere? e.g.
Plugin namespace: Plugin\Commerce\OrderReportType.should bePlugin namespace: Plugin\Commerce\ReportType..Comment #9
chrisrockwell commentedUpdate patch to remove
Order|orderwhen appropriate. This means we have@CommerceReportTypeinstead of@CommerceOrderReportTypeand, e.g.ReportTypeInterfaceinstead ofOrderReportTypeInterface.Comment #10
chrisrockwell commentedJust adding new lines where appropriate.
Comment #11
chrisrockwell commentedVia Slack Matt and I discussed using annotations to declare dependencies.
Comment #12
chrisrockwell commentedThere is no need to do any dependency checking, plugins that we include which depend on other modules being enabled (e.g. commerce_promotion) should define a
providerin their annotation.Comment #13
chrisrockwell commentedI'm coming back to this now that I'm looking at the actual creation of reports. I think it's very typical that for any report (promotion, stock, etc.) one would want the order total on each report. The architecture I've proposed makes that more difficult to join, e.g. a promotion report to an order report to get the amount. I *think* the best solution for this is to use an
order_identity reference field on each report. This makes it simple to join different reports.Comment #14
chrisrockwell commentedI'm changing my mind again, and swinging in a different direction. I don't think the default report should contain order_id.
We have a CommerceReport Entity type that provides bundle plugin, commerce_report_type
- An OrderReport is a bundle with order_id, amount, etc.
- A single use promotion report can store order_id if we want
- A report such as an aggregate report that gets updated as necessary doesn't need an order_id
Aggregate reports are useful, having an order_id with them doesn't make sense.
Comment #15
chrisrockwell commentedJust in case there isn't enough variations in this issue, I'm attaching one more. This one presumes not all commerce reports are "order reports". So reports simply have uuid, updated, created. The included plugin, OrderReport, adds a report with order id and amount.
As I said previously, I'm finding aggregate reports to be more useful (and likely performant) but the entity having order_id as a base field doesn't make sense for that. Admittedly, I don't know anything about the 7.x use cases so I could be way off in thinking this is better.
Comment #17
mglamanAdd bundle to test.
Comment #18
mglamanApparently, I forgot how to patch.
Comment #20
mglamanFix method
Comment #22
mglamanOne more try.
Comment #24
mglamanCOMMITTED! HOLY DELAYED BUT IT IS IN!