[SOLVED] Build an unique array with Neos.Fusion:Map

Hello!

Is there a possibility to build an array with unique values like this?

properties = Neos.Fusion:Map {
    items = ${myItems}
    itemName = 'item'
    itemRenderer = ${item.properties.myProperty}
}

Thanks so much!
Matthias

Hey @Matschess,
could you rephrase your question? What are you trying to achieve?

Cheers,
Daniel

Hey @daniellienert!

Sorry!
I built an array of properties with Neos.Fuions:Map and I am searching for a way to keep only unique values in the array, since I have a lot of duplicated entries.

Greetings,
Matthias

Well you would need a php array_unique exposed as eel_helper. A quick trick could be a double-flip :slight_smile:

@jonnitto also built a helper package with array methods like unique

If you use the newest version of Neos you could write:

properties = Neos.Fusion:Map {
    items = ${myItems}
    itemRenderer = ${q(item).property('myProperty')}
    @process.removeDuplicates = ${Array.unique(value)}
}

Another small hint: q(item).property('myProperty') is much faster than item.properties.myProperty, as it only loads one and not all properties

Do you have an idea why the new Eel helpesr are not in the documentation? I mean, in the source code everything looks good: https://github.com/neos/flow-development-collection/blob/6.1/Neos.Eel/Classes/Helper/ArrayHelper.php

Thanks! Works perfect!
Thanks to all for the hints!!