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

        /** @var ObjectInterface $element */
        foreach ($this->getIterator() as $element) {
            $list[(string) $element->getProperty($property)][] = $element;
        }

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

        /** @var ObjectInterface $element */
        foreach ($this->getIterator() as $element) {
            $list[(string) $element->getProperty($property)][] = $element;
        }

        return $list;
    }
public function group ( $ property ) { $ list = [ ] ; /** @var ObjectInterface $element */ foreach ( $ this -> getIterator ( ) as $ element ) { $ list [ ( string ) $ element -> getProperty ( $ property ) ] [ ] = $ element ; } return $ list ; }
Group items in the collection by a field and return them as associated array.

@param string $property
@return array
Group items in the collection by a field and return them as associated array .