/** * Return Models found in the db where the var has the value $value * @param String $var The var to compare * @param mixed $value The value of the var * @return \App\Component\Model; */ public static function getBy($array) { $objects = Database::getWhere(self::getCollectionName(), $array); $hydrated = array(); foreach ($objects as $object) { $className = get_called_class(); $model = new $className(); $model->hydrate($object); $hydrated[] = $model; } return $hydrated; }