{"id":16399420,"url":"https://github.com/dimaip/dimaip.groupby","last_synced_at":"2025-03-23T05:31:06.001Z","repository":{"id":11349405,"uuid":"69387162","full_name":"dimaip/Dimaip.GroupBy","owner":"dimaip","description":"FlowQuery groupBy operation to group arrays by EEL discriminator","archived":false,"fork":false,"pushed_at":"2023-09-28T12:07:56.000Z","size":50,"stargazers_count":6,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T18:02:29.609Z","etag":null,"topics":["neoscms"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dimaip.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-09-27T18:35:06.000Z","updated_at":"2022-09-27T14:13:38.000Z","dependencies_parsed_at":"2022-08-07T06:01:22.638Z","dependency_job_id":"46ccfa9b-5525-4130-bae8-71611855fba4","html_url":"https://github.com/dimaip/Dimaip.GroupBy","commit_stats":{"total_commits":101,"total_committers":4,"mean_commits":25.25,"dds":"0.19801980198019797","last_synced_commit":"c58d780043dbf879bdb85a4c170152d48d6f9ef1"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimaip%2FDimaip.GroupBy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimaip%2FDimaip.GroupBy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimaip%2FDimaip.GroupBy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimaip%2FDimaip.GroupBy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimaip","download_url":"https://codeload.github.com/dimaip/Dimaip.GroupBy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245061382,"owners_count":20554563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["neoscms"],"created_at":"2024-10-11T05:24:13.416Z","updated_at":"2025-03-23T05:31:05.669Z","avatar_url":"https://github.com/dimaip.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dimaip.GroupBy\nFlowQuery groupBy operation to group arrays by EEL discriminator\n\nOnce upon a time I had a list of persons nodes, and I needed to group them by first letter.\nSo I decided there should be a generic way to group array of nodes into subgroups, based on an EEL expression... And here it is!\n\n## TL;DR\n\nInstall: `composer require dimaip/groupby`\n\nUse:\n```\ngroupedNodesByFirstLetterOfLastName = ${q(nodes).groupBy('String.substring(node.properties.lastName, 0, 1)')}\n```\n\n## Full example\n\nOnce you have grouped the nodes, you can render them any way you like: with Fluid (yikes!) or with Fusion (yay!).\n\n```\nprototype(Name.Space:GroupedList) \u003c prototype(TYPO3.TypoScript:Collection) {\n\t@process.tmpl = ${'\u003cdiv class=\"grouped-list\"\u003e' + value + '\u003c/div\u003e'}\n\t@context.nodes = ${q(site).find('[instanceof Name.Space:Person]')}\n\tcollection = ${nodes.groupBy('String.substring(node.properties.lastName, 0, 1)')}\n\titemName = 'nodes'\n\titemKey = 'firstLetter'\n\titemRenderer = TYPO3.TypoScript:Collection {\n\t\t@process.tmpl = ${'\u003cdiv\u003e\u003ch2\u003e' + firstLetter + '\u003c/h2\u003e\u003cul\u003e' + value + '\u003c/ul\u003e\u003c/div\u003e'}\n\t\tcollection = ${nodes}\n\t\titemName = 'node'\n\t\titemRenderer = ${'\u003cli\u003e' + node.properties.firstName + ' ' + node.properties.lastName + '\u003c/li\u003e'}\n\t}\n}\n```\n\nIn a similar way you can group nodes based on a very complex EEL expressions, let your imagination fly!\n\n## Credit\n\nInitial development sponsored by Stefan Johänntgen\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimaip%2Fdimaip.groupby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimaip%2Fdimaip.groupby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimaip%2Fdimaip.groupby/lists"}