public function group($property, $separator = null)
    {
        $list = [];

        /** @var NestedObjectInterface $element */
        foreach ($this->getIterator() as $element) {
            $list[(string) $element->getNestedProperty($property, null, $separator)][] = $element;
        }

        return $list;
    }
public function group($property, $separator = null)
    {
        $list = [];

        /** @var NestedObjectInterface $element */
        foreach ($this->getIterator() as $element) {
            $list[(string) $element->getNestedProperty($property, null, $separator)][] = $element;
        }

        return $list;
    }
public function group ( $ property , $ separator = null ) { $ list = [ ] ; /** @var NestedObjectInterface $element */ foreach ( $ this -> getIterator ( ) as $ element ) { $ list [ ( string ) $ element -> getNestedProperty ( $ property , null , $ separator ) ] [ ] = $ element ; } return $ list ; }
Group items in the collection by a field.

@param string $property      Object property to be used to make groups.
@param string $separator     Separator, defaults to '.'
@return array
Group items in the collection by a field .