private function groupHeroes(&$heroes) { $primaryAttributes = PrimaryAttributePeer::retrieveAll(); $_heroes = $heroes; $grpHeroes = array(); foreach ($primaryAttributes as $iObj) { $grpHeroes[$iObj->getName()] = array(); } foreach ($_heroes as $hero) { $attribute = $hero->getPrimaryAttribute(); $grpHeroes[$attribute->getName()][] = $hero; } $heroes = $grpHeroes; // return }