Problem/Motivation
Improve existing architecture before implementing advanced inheritance feature (#3461075: Inheriting segments of parent prompt in user interface).
Proposed resolution
Repeat same architecture like was done with new arguments feature (#3443027: Allow to pass arguments to aiprompt programatically), enabling to cleanly load segments of the parent prompt.
Make getSegments() return plugin instances instead of segments data, while new getSegmentsData() return the data instead.
Move getSegments() from entity classes to a common trait (same like getArguments() already is).
Redo all places which use getSegments().
Result will also be less and simpler code where objects are already instantiated, or in other places setter methods being used instead of processing raw data.
Comments
Comment #2
mindaugasd commentedComment #4
mindaugasd commentedComment #5
mindaugasd commentedWill upgrade segment forms as well to use objects instead of data.
Comment #7
mindaugasd commented