- Issue created by @Istari
- 🇩🇪Germany jurgenhaas Gottmadingen
I'd be happy to review this if something is available.
- Merge request !469Issue #3500732 by mysdiir: Action that combines two lists. → (Open) created by Unnamed author
- 🇩🇪Germany jurgenhaas Gottmadingen
Left a couple of comments in reply to your questions.
In addition to that, I've seen you're combining the values from the config? I'd say, what's configured in config is a token name, so those tokens are placeholders for the lists that have been stored in them before. That means, you need to use the token service to receive the lists first, and the result is what you then need to combine.
- 🇩🇪Germany jurgenhaas Gottmadingen
And one more thought: is this really about
array_combine
? Might well be the intention of this plugin, I just don't know what a use case could be.When this issue was opened, I had something like
array_merge
in mind, but that was probably a mistake at my end. Needs some clarification, I guess. - 🇩🇪Germany Istari
Well I'm open to change the logic to merge the two lists into one.
But you might be right I can imagine that there could be more potential use cases where a list merge is more needed than a combined list.
Also a merge list action would remove multiple entries of the same value.
Sry hadn't thought about this. - 🇩🇪Germany jurgenhaas Gottmadingen
The
array_combine
function is combining a list of keys with a list of values. Not sure, if we have a use case for that?I can certainly see a use case for merging arrays, maybe even for deep merge.
Please also note the test errors on the MR.
- 🇩🇪Germany Istari
I am currently in testing and polishing phase.
My idea with merging two list is, that we not only make sure we remove duplicates in the merged list, but we also have to take a look on their respective data types.Let me give an example:
What if we need to merge two Node objects from two lists into one?
How can we check if the Node Object from list one is the same from list two?
What array_merge() in case of objects does is, it puts both objects into into the merged array.So I implemented a method isEqual() that checks either in case of an entity for the id or in case of typed data the value.
I'm currently running out of time with my work, but I will upload the result during today, when the final testing is done.
- 🇩🇪Germany jurgenhaas Gottmadingen
I've left a couple of comments in the MR. And with regard to the duplicate handling, I think this is out of scope for this action plugin. De-duplicating and maybe sorting a list should be separate action plugins. It's much more flexible if we keep the actions granular as users then can combine them as they need to.
- 🇩🇪Germany jurgenhaas Gottmadingen
I've left a few code change suggestions and comments in the MR. We should then also have some tests for this.
- 🇩🇪Germany jurgenhaas Gottmadingen
Getting close. Two more comments in the MR and a test is also required for this.
- Issue was unassigned.
- Status changed to Needs review
10 days ago 4:59pm 23 March 2025 - 🇩🇪Germany jurgenhaas Gottmadingen
This is looking good now. Only a tiny clean-up is left to remove 2 obsolete lines of code.
After that, only tests are required. They should at least test a couple of list merges and also test the cases that would not be executed due to the access control.