Neos\Neos\Fusion\Helper\ArrayHelper::groupBy PHP Method

groupBy() public method

The input is assumed to be an array or Collection of objects. Groups this input by the $groupingKey property of each element.
public groupBy ( array | Doctrine\Common\Collections\Collection $set, string $groupingKey ) : array
$set array | Doctrine\Common\Collections\Collection
$groupingKey string
return array
    public function groupBy($set, $groupingKey)
    {
        $result = array();
        foreach ($set as $element) {
            $result[ObjectAccess::getPropertyPath($element, $groupingKey)][] = $element;
        }
        return $result;
    }