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
MyrestReviewsAggregatorandMyrestCountersbehind interfaces. - Resolve the outbound calls: the page URL methods now live in
MyrestPageUrlResolverand can be injected; the storage accessors andgetLangcode()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
staticCachearray.
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
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