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.
Problem/Motivation
The entity.query, entity.query.sql and the entity.query.keyvalue services are factories and yet they are not named so.
Proposed resolution
Rename them to *.factory making them in line with cache.factory, config.factory, logger.factory etc etc
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#35 | entity-query-2156883-35.patch | 26.31 KB | Gaelan |
| |||
#31 | the_entity_query-2156883-31.patch | 26.25 KB | dimaro |
#26 | 2156883-26.patch | 26.14 KB | heykarthikwithu |
#23 | 0001-2156883-entity.query-service-name-is-very-confusing..patch | 29.54 KB | darol100 |
#22 | the_entity_query-2156883-22.patch | 25.03 KB | deepakaryan1988 |
Comments
Comment #1
tim.plunkettThis matches config.factory (the other factory I interact with on a daily basis).
+1, RTBC if green
Comment #2
xjmeqf.patch queued for re-testing.
Comment #4
tim.plunketteqf.patch queued for re-testing.
Comment #6
chx CreditAttribution: chx commentedComment #7
richardcanoe CreditAttribution: richardcanoe commentedRerolled & extended the patch, changed all instances of entity.query to entity.query.factory
Comment #8
chx CreditAttribution: chx commentedThanks for the additional work! I think
entity.query.factory.config
looks strange and doesn't adhere to the pattern established and should readentity.factory.config.query
and the same for sql and keyvalue.Comment #9
richardcanoe CreditAttribution: richardcanoe commentedChanged config, sql and keyvalue as requested. Now I'm confused!
Comment #10
chx CreditAttribution: chx commentedOMG. What did I write. I am so wrong and I am so sorry! Please accept my apologies and this corrected patch.
Comment #11
alexpottCan we add an alias for
entity.query
to theentity.query.factory
. This makes the change far far less disruptive for existing contrib. Can we also include a comment that this service will be removed in Drupal 9.Also since this is disruptive a beta evaluation would be great. Can someone add Drupal 8 beta phase evaluation template to the issue summary.
Comment #12
chx CreditAttribution: chx commentedIf that's the case then why don't we just postpone the whole thing to D9? There's hardly any point AFAIK.
Comment #13
alexandre.todorov CreditAttribution: alexandre.todorov commentedHi,
I'm working on this issue in Drupal Dev Days Mentor Sprint Montpellier (France) 2015
Comment #14
alexandre.todorov CreditAttribution: alexandre.todorov commentedRerolled the patch #10 and added service aliases for existing contrib.
Comment #15
dimaro CreditAttribution: dimaro at La Drupalera by Emergya commentedChange status to Needs review.
Comment #19
dimaro CreditAttribution: dimaro at La Drupalera by Emergya commentedCorrect the service aliases.
Hope it works.
Comment #20
cilefen CreditAttribution: cilefen commentedComment #21
deepakaryan1988Comment #22
deepakaryan1988Removing needs reroll tag
and I am re-rolling the patch #19 .
Comment #23
darol100 CreditAttribution: darol100 as a volunteer and commentedI think we should fix the comments as well ?
If so here are few things that are needs work.
d8/core/lib/Drupal/Core/Entity/EntityStorageBase.php
Line 477: // Access the service directly rather than entity.query factory so the
Line 486: // Access the service directly rather than entity.query factory so the
d8/core/lib/Drupal/Core/Entity/Query/QueryFactory.php
Line 22: * @todo https://www.drupal.org/node/2389335 remove entity.query service and
In this patch I change entity.query -> entity.query.factory in comments as well. If we do not have to change entity.query -> entity.query.factory in comments, the patch #22 is ready to go.
Comment #24
dimaro CreditAttribution: dimaro at La Drupalera by Emergya commentedWhat is the status of this issue?
At the moment, Needs reroll.
Comment #25
heykarthikwithuComment #26
heykarthikwithuComment #28
darol100 CreditAttribution: darol100 as a volunteer and commentedThis looks to me like an API change, if so we can't do it. I will move it to next minor release just in case, even though this might not get committed.
Comment #29
BerdirMinor releases can't do API changes either, only additions.
Possibly we just want to deprecate this in favor of getStorage('node')->getQuery() and remove it in 9.x.
Comment #31
dimaro CreditAttribution: dimaro at La Drupalera by Emergya commentedRerolled #26. Patch to 8.2.x.
Comment #34
dimaro CreditAttribution: dimaro at La Drupalera by Emergya commentedThe latest patch should be rerolled against 8.3.x
Comment #35
Gaelan CreditAttribution: Gaelan as a volunteer and at Google Code-In commentedRerolled.
Comment #37
BerdirAs I wrote above, we shouldn't be changing those services IMHO instead we should just remove them. See #2389335: Deprecate entity.query service and replace with using the entity storage's getQuery() method. I'd say we should close this as a duplicate of that issue.
Comment #38
BerdirThe mentioned issue just removes the main service, the others remain. So not a duplicate, but postponed on that, most of it would go away after that.
And unlike the current patch, might actually be possible in 8.x, not sure.