Problem/Motivation
The names of some of these are totally misleading. It rather seems that as these were added over time, we just reached for combinations of the words 'flag', 'count', and 'entity' that weren't already used for existing functions...
Once #2476499: Give the documentation of the flag count API some love. has done the job of clearly explaining what each of these does, we should think about how to name them more clearly.
Proposed resolution
Discuss better names and change them.
API changes
The flag.count service's method names will change.
Remaining tasks
- write a patch
- update the CR at https://www.drupal.org/node/2476349 with the new method names
Comments
Comment #1
joachim commentedComment #2
joachim commentedCopied from a duplicate issue:
Comment #3
joachim commentedTo summarize, we have 4 methods currently in the count API, which can be briefly described thus:
- get a summary of all the flag counts on a single entity
- get the count of all of a flag's flaggings
- get the count of all of a flag's flagged entities
- get the count of all of a flag's flagged entities for a particular user
Let the bikeshedding begin!
Off the top of my head, I propose:
- get a summary of all the flag counts on a single entity: getEntityCounts
- get the count of all of a flag's flaggings: getFlaggingCount
- get the count of all of a flag's flagged entities: getEntityCount (urgh! one letter away from getEntityCounts! We need something better)
- get the count of all of a flag's flagged entities for a particular user: getUserFlaggingCount
Comment #4
joachim commentedBit more specific, but more wordy:
- get a summary of all the flag counts on a single entity: getEntityFlagCounts
- get the count of all of a flag's flaggings: getFlagFlaggingCount
- get the count of all of a flag's flagged entities: getFlagEntityCount
- get the count of all of a flag's flagged entities for a particular user: getUserFlaggingCount... but then strictly speaking, this one should be getUserFlagFlaggingCount, no?
Comment #5
joachim commented#2476499: Give the documentation of the flag count API some love. has been committed to the D8 branch.
Comment #6
joachim commentedI'm going to set this to needs review, since the proposed name changes need review before a patch is made.
Comment #7
socketwench commentedAll the names in #4 are good except getUserFlaggingCount(). It would make sense if the FlagInterface parameter was optional. If we plan on doing that, I'd be fine with getUserFlaggingCount().
Comment #8
Anonymous (not verified) commentedComment #9
Anonymous (not verified) commentedHere is my patch. I used getUserFlagFlaggingCount name for getUserCounts method because we didn't change it implementation.
Please review.
Comment #10
socketwench commentedReroll.
Comment #12
joachim commented> I used getUserFlagFlaggingCount name for getUserCounts method because we didn't change it implementation.
Yup, that makes sense.
Thanks for the patch & the reroll.
Committed, and CR updated.