symphonists / uniondatasource

A union datasources allows you to combine multiple datasources to output a single datasource for the primary purpose of a unified pagination.
13 stars 11 forks source link

Group by #39

Open nilshoerrmann opened 10 years ago

nilshoerrmann commented 10 years ago

Is there a way to group the output of a Union Data Source by a field, e. g. a date fields that are named consistently across all united sources?

brendo commented 10 years ago

Not really, I wrote a long comment in the code to remind me.

Grouping will be very difficult with UnionDS. The current Grouping works on an array level, rather then the springs to mind SQL GROUP BY. Grouping calls the grouped field's groupRecords function, which loops over the $entries array getting the data for the grouped field. The problem is that this uses the field_id, so it cannot apply to other entries who are in different sections. This code untouchable inside the Field class, so it would require something fairly crude I'd imagine to replicate. Perhaps the $entries would have to be dissolved into same section groups and run a group on each section before merging the array together... which has it's own set of problems, not happening anytime soon unfortunately.