Support PriceSet as ManagedEntity - #35329
Conversation
|
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
I think ideally
That seems good though complex. No guarantee in general that the targeted entity has a |
Personally I'd like to get rid of the dependency on PriceSet and PriceSetEntity altogether for linking entities. It's just that's how it is at the moment (for events anyway). I did start a bit of work in that direction but didn't get very far yet. The idea though would be to link PriceFieldValue (or PriceField) directly via dynamic entity_id/entity_table so you can link a price to any entity - that would work much better for things like Formbuilder payments and shopping cart. I wanted to get what we have working for export first though. Eg. supporting dynamic foreign key for export/import would open up quite a few more entities (and the possible future "PriceFieldValueEntity") to being portable on export/import. |
Yep makes sense, I think there's general support for that.
My vote would be for Price Field from a FormBuilder perspective. I be keen to avoid Not sure about the short term answer though sorry 🤔 |
PriceSet.extends stores a serialized array of civicrm_component ids, which are not portable across sites. ExportAction previously excluded all callback-based pseudoconstants from `:name` export on the assumption their option lists are unstable, but PriceSet's getExtendsOptions() callback returns stable component names (CiviEvent, CiviContribute, CiviMember) that are safe to rely on. Add an explicit 'portable' => TRUE opt-in flag that a field's pseudoconstant can set to override the default exclusion, and use it for PriceSet.extends so PriceSet.export() emits `extends:name` instead of a raw, non-portable component id.
|
Once #36338 is merged this will support fully portable PriceSetEntity export/import |
|
@mattwire done |
|
@colemanw This one should be good to go if you're happy with it? |
Overview
There are two issues
The "extends" field maps to a component ID:Now supported via f3e5d6aie. that extends field should map to component names for portability.
Export doesn't support dynamic foreign keys for export:- see Api4 - Support portable export/import for dynamic foreign keys #36338ie. entity_id should map to name instead of id for portability.
Before
No support for PriceSets as managed entities
After
Support for PricesSets as managed entities
Technical Details
Adds ManagedEntity trait.
Comments
@Coleman @ufundo Any thoughts on how to solve the above?