Problem/Motivation

Two related groups remain in MyrestHelper. Reviews aggregation covers getReviewsAggregateRating(), getReviewsAggregateRatingByService(), getReviewsByServices(), getVideoReviewsByServices(), getReviewsByDoctor() and getReviewFrameStructure(). Counters cover getCounters(), getTermsCount(), getNodesCount(), getCountBlogs(), getPromotionsCount(), getBeforeAfterCountByService(), getDoctorsCountByService() and getServiceRelatedCounters().

Together they are around 200 lines but make nine calls into the rest of the helper, which is why issue 32 left them alone. They are also the heaviest database users in the class, so isolating them makes the caching work in issue 60 tractable.

Proposed resolution

  • Extract MyrestReviewsAggregator and MyrestCounters behind interfaces.
  • Resolve the outbound calls: the page URL methods now live in MyrestPageUrlResolver and can be injected; the storage accessors and getLangcode() can be duplicated cheaply.
  • getChildServicesIds() is shared with the services group and needs a decision on where it belongs.
  • Give both services their own cache handling rather than sharing the helper's staticCache array.

Remaining tasks

Extract both groups and add kernel tests covering the aggregate rating queries.

User interface changes

None.

API changes

New MyrestReviewsAggregatorInterface and MyrestCountersInterface. Facade methods deprecated.

Issue fork myrest-3616672

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 a8fe335d on 1.0.x
    Issue #3616672: Extract the reviews aggregator and the counters out of...
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)