Problem/Motivation
Issue 32 extracted the three method groups that had little or no coupling to the rest of MyrestHelper. The largest group is still in place: paragraph rendering spans roughly 1450 lines across 31 methods, from getStructureByParagraph() through the individual getParagraph*Structure() handlers to getParagraphsStructure().
Unlike the image, menu and URL groups, this one calls back into images, articles, discounts, reviews and prices, so it cannot simply be lifted out. Extracting it naively produces a circular service reference between the builder and the facade.
Proposed resolution
- Map every outbound call the paragraph methods make, and decide per call whether the target belongs in a shared collaborator or should be injected.
- Consider a paragraph handler plugin type keyed by paragraph bundle, so each handler is registered rather than dispatched through one long conditional, and third parties can add their own.
- Where the builder genuinely needs the facade, inject it lazily (setter injection or a service closure) rather than through the constructor, to avoid a circular container reference.
- Move
addAnchorsParagraphFromParagraphsList(),calculateStageTotal()andcalculateServiceCalculation()along with the group. - Keep
MyrestHelperdelegating, with the facade methods deprecated as in issue 32.
Remaining tasks
Produce the call map, decide on the plugin approach, then extract incrementally with tests for each handler.
User interface changes
None.
API changes
New MyrestParagraphBuilderInterface. Possibly a new paragraph handler plugin type. Facade methods deprecated.
Issue fork myrest-3616660
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
sergeydruua commentedComment #6
sergeydruua commented