src/php/Webforge/Common/ArrayUtil.php
public static function indexBy(Array $array, $property) {
    $ret = array();

    if (count($array) > 0) {
      $index = Util::castGetterFromSample($property, current($array));

      foreach ($array as $item) {
        $ret[$index($item)] = $item;
      }
    }

    return $ret;
  }
public static function indexBy(Array $array, $property) {
    $ret = array();

    if (count($array) > 0) {
      $index = Util::castGetterFromSample($property, current($array));

      foreach ($array as $item) {
        $ret[$index($item)] = $item;
      }
    }

    return $ret;
  }
public static function indexBy ( Array $ array , $ property ) { $ ret = array ( ) ; if ( count ( $ array ) > 0 ) { $ index = Util :: castGetterFromSample ( $ property , current ( $ array ) ) ; foreach ( $ array as $ item ) { $ ret [ $ index ( $ item ) ] = $ item ; } } return $ ret ; }
Returns an array with the index constructred from objects in the collection

@param mixed $property see pluck() for details
@return array
Returns an array with the index constructred from objects in the collection