Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Updated: Comment #N
Problem/Motivation
ForumManager is doing too much, much like #2188287: Split CommentManager in two
We still have SQL queries in forum.module that need to be behind a swappable service.
Proposed resolution
Create ForumRepository for SQL stuff in forum.module
Move relevant bits of ForumManager into ForumRepository.
Remaining tasks
Review
User interface changes
None
API changes
New ForumRepositoryInterface
ForumManagerInterface::updateIndex() removed.
Comment | File | Size | Author |
---|---|---|---|
#50 | interdiff.txt | 4.84 KB | slashrsm |
#50 | 2205185_49.patch | 20.11 KB | slashrsm |
#44 | forum-storage-2205185-2.29.44.patch | 20.26 KB | andypost |
Comments
Comment #1
larowlantackling this week
Comment #2
chx CreditAttribution: chx commentedForumRepository? Why not the forum storage controller??
Comment #3
larowlanYeah can be ForumStorageController but its not a storage controller in the EntityStorageController sense of the word.
So perhaps ForumStorage makes more sense?
Naming things is hard :)
Comment #4
tstoecklerWell, we're renaming FooStorageController to FooStorage, so that would be the same conflict :-/
Comment #5
tstoeckler#2188613: Rename EntityStorageController to EntityStorage
Comment #6
larowlanForumRepository it is then ;)
Comment #7
chx CreditAttribution: chx commentedSure.
Comment #8
larowlanFirst attempt
method names follow the CRUD acronym, duplicated for the index
With this patch, there is no SQL in forum.module
Comment #9
larowlangreen :)
Comment #10
andypostThe comment exists, because count>0.
So second query needs to fetch "created" only
The $node is already passed as argument, suppose query could be skipped
Comment #11
jibranNW as per #10.
Comment #12
larowlanadding reroll tag
Comment #13
hairqles CreditAttribution: hairqles commentedThe patch has been rerolled.
Comment #15
hairqles CreditAttribution: hairqles commentedcontinue the work on the reroll
Comment #16
hairqles CreditAttribution: hairqles commentedAttached the updated patch.
Comment #17
hairqles CreditAttribution: hairqles commentedUpdated the patch according to comment #10
Comment #18
hairqles CreditAttribution: hairqles commentedRemoved deprecated comment.
Comment #21
hairqles CreditAttribution: hairqles commentedComment #22
hairqles CreditAttribution: hairqles commentedComment #23
hairqles CreditAttribution: hairqles commentedComment #24
andypostThis issue is a part of #2068325: [META] Convert entity SQL queries to the Entity Query API
Suppose that's should be enough because all queries here are encapsulated in single service and the most of them used to change data.
Queries that fetches data are highly optimized and does not need any alter for translation
Comment #25
andypostComment #26
alexpottThe issue summary says that ForumManagerInterface is removed - does not appear to be.
I guess the plan wrt to change notices is to expand https://drupal.org/node/2079767?
Can remove the use ... CommentInterface from the manager.
Comment #27
larowlan@hairqles, next time could you please post an interdiff? thanks.
Re-roll and removes the surplus use statement.
Comment #28
larowlanUpdated issue summary to reflect patch (which is still green).
Comment #29
andypostrtbc again
Comment #30
xjmNaming things is hard, indeed. :) I have no idea what a forum repository is. If it's not ForumStorage because it's not an entity storage handler... can we give it a longer and more descriptive name? ForumIndexSomething would be better since that makes it clear it manages the {forum_index} table.
Comment #31
larowlangrep -ilr ForumRepository core | while read r; do gsed -i 's/ForumRepository/ForumIndexStorage/g;s/forum_repository/forum_index_storage/g' $r;done
Comment #32
larowlanComment #34
larowlandoh, needed
too
Comment #35
andypostso "naming" resolved
Comment #36
roderikFWIW and referring to #2/#3:
I am going to assume that the suffix 'Storage' is not off limits for anyone creating their non-entity storage.
Which I agree with - and which is a larger thing than just this issue. I mean why would entities monopolize the term 'Storage'? Are we going to forbid e.g. metatag.module to call a class MetatagStorage?
(...so this class could have been named ForumStorage too :p but I don't mind one way or the other.)
Just noting this, as the guy who is probably going to take a stab at creating TrackerStorage...
Comment #37
xjmRe: #36: Well the thing is that it's not the actual forum storage... it's a lookup table. :) So ForumIndexStorage is indeed a clear/correct name.
Comment #38
xjmThe change record https://drupal.org/node/2079767 does not have a reference to this issue yet; should it? Will it need an update?
Comment #39
larowlanI'll update the change record once in
Comment #40
xjmThanks @larowlan. I've edited https://drupal.org/node/2079767 to add a reference to this issue.
Comment #42
andypostre-roll
Comment #44
andypostproper merge
Comment #46
larowlan44: forum-storage-2205185-2.29.44.patch queued for re-testing.
Comment #47
larowlanFail was in HEAD
Comment #48
alexpottBut we're still calling the service forum.repository? In my mind this should
forum.index_storage
Comment #49
marcingy CreditAttribution: marcingy commentedComment #50
slashrsm CreditAttribution: slashrsm commentedReroll to PSR-4 and fixed service name.
Comment #51
marcingy CreditAttribution: marcingy commentedLooks good if green.
Comment #52
alexpottCommitted 1b34836 and pushed to 8.x. Thanks!