Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
entity system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
7 May 2012 at 16:22 UTC
Updated:
12 Oct 2016 at 20:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
fuerst commentedNope, there isn't. At least not when looking at DRUPAL7/includes/entity.inc.
Comment #2
bojanz commentedYep, no GROUP BY.
Comment #3
chx commentedComment #4
donutdan4114 commentedTesting entity groupBy patch for D7.
Comment #5
donutdan4114 commentedUpdated patch to most recent version of Drupal core.
Comment #7
donutdan4114 commentedFixed path issue in patch.
Comment #8
chx commentedYou need David Rothstein to decide this but I am fairly sure this is a won't fix. We are working on this for the new entity query for D8 but in D7, I do not think this is a viable idea.
Comment #9
chx commentedSo, David, should we pursue this?
Comment #10
donutdan4114 commentedWhy would it not be a viable idea? Do new features not get added to D7?
I think it would be great to have. EntityFieldQuery supports other basic operations like orderBy.. Not sure why groupBy wasn't included... Is there a reason?
Comment #11
chx commentedNew features in general go against D8, small API additions occasionally make D7. The decision lies with the D7 maintainer.
Comment #12
donutdan4114 commentedIt should be noted that the patch in #7 is not complete.
The fieldGroupBy logic is not complete. I wasn't sure where to put it.
I tried to reference fieldOrderBy, but couldn't find where the logic happened.
Comment #13
David_Rothstein commentedOops, apparently this has been assigned to me for the last six months. Sorry :(
I don't think I have much to add beyond what's already at https://drupal.org/node/1527558. Small API additions are allowed. And one thing this patch definitely has going for it is that it appears to be completely backwards compatible.
In short, I don't really have a strong feeling either way on this one; so if the community decides adding GROUP BY support is a good idea for Drupal 7 still, I'd be willing to commit a patch that does that.
Comment #14
gusantor commentedIt would be great to have groupby on EFQ :)
Comment #15
chx commentedThe big problem, sorry for not realizing this back in January is that your return value can only be the results of some aggregation function or the GROUP BY column. Now, our return values are entity ids. I do not know how to solve this without changing the output format. D8 EntityQuery has a very different return format for aggregator and normal queries to boot.
Comment #16
sylvain lecoy commentedI would love to see this for D7 as well.
Comment #17
sylvain lecoy commentedchx, if developers does not use the fieldGroupBy, the output does not change isn't it ?
So we maintain compatibility, and this change remains backward compatible. An API changes is not necessarily bad when adding a new method, as it does not create regressions.
Comment #18
sylvain lecoy commentedI also tested this patch and see nothing changing when trying to group by.
The result set looks exactly the same. Not sure how to use this patch.
Comment #19
sylvain lecoy commentedSeems this is not implemented for fields actually !
Comment #20
donutdan4114 commentedCorrect, not implemented for fields. I was hoping someone could help me with that.
Comment #21
donutdan4114 commented#7: entity-groupby-1565708-7.patch queued for re-testing.
Comment #23
Dumitru Grosul commentedYou ca use query tags to achieve this. Add a custom tag to the query and implement the hook_query_TAG_alter().
Comment #24
reign85 commentedI would love to see this for D7 as well
Comment #25
Chris CharltonStalled?