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() and calculateServiceCalculation() along with the group.
  • Keep MyrestHelper delegating, 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

Command icon 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

sergeydruua created an issue. See original summary.

  • sergeydruua committed 772e45c2 on 1.0.x
    Issue #3616660: Extract the paragraph builder out of the helper
    
sergeydruua’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

sergeydruua’s picture

Status: Fixed » Closed (fixed)