lib/db/cortex.php
public function getBy($index, $nested = false) {
		$out = array();
		foreach ($this->getArrayCopy() as $model)
			if ($model->exists($index)) {
				$val = $model->get($index, true);
				if (!empty($val))
					if($nested) $out[(string) $val][] = $model;
					else        $out[(string) $val] = $model;
			}
		return $out;
	}
public function getBy($index, $nested = false) {
		$out = array();
		foreach ($this->getArrayCopy() as $model)
			if ($model->exists($index)) {
				$val = $model->get($index, true);
				if (!empty($val))
					if($nested) $out[(string) $val][] = $model;
					else        $out[(string) $val] = $model;
			}
		return $out;
	}
public function getBy ( $ index , $ nested = false ) { $ out = array ( ) ; foreach ( $ this -> getArrayCopy ( ) as $ model ) if ( $ model -> exists ( $ index ) ) { $ val = $ model -> get ( $ index , true ) ; if ( ! empty ( $ val ) ) if ( $ nested ) $ out [ ( string ) $ val ] [ ] = $ model ; else $ out [ ( string ) $ val ] = $ model ; } return $ out ; }
return all models keyed by a specified index key
@param string $index
@param bool $nested
@return array
return all models keyed by a specified index key