Add ruby-like group_by functionality.

Requires next changes in Doctrine/Common/Collections/ArrayCollection:
https://github.com/imenem/common/commit/33c240a2f46f01afc9201e760c3ba1da97a7bfc4