public static function fetch($params) {
        if ($records = self::retrieve_record_set($params)) {
            return reset($records);
        }

        $record = grade_object::fetch_helper('grade_categories', 'grade_category', $params);

        // We store it as an array to keep a key => result set interface in the cache, grade_object::fetch_helper is
        // managing exceptions. We return only the first element though.
        $records = false;
        if ($record) {
            $records = array($record->id => $record);
        }

        self::set_record_set($params, $records);

        return $record;
    }
public static function fetch($params) {
        if ($records = self::retrieve_record_set($params)) {
            return reset($records);
        }

        $record = grade_object::fetch_helper('grade_categories', 'grade_category', $params);

        // We store it as an array to keep a key => result set interface in the cache, grade_object::fetch_helper is
        // managing exceptions. We return only the first element though.
        $records = false;
        if ($record) {
            $records = array($record->id => $record);
        }

        self::set_record_set($params, $records);

        return $record;
    }
public static function fetch ( $ params ) { if ( $ records = self :: retrieve_record_set ( $ params ) ) { return reset ( $ records ) ; } $ record = grade_object :: fetch_helper ( 'grade_categories' , 'grade_category' , $ params ) ; // We store it as an array to keep a key => result set interface in the cache, grade_object::fetch_helper is // managing exceptions. We return only the first element though. $ records = false ; if ( $ record ) { $ records = array ( $ record -> id => $ record ) ; } self :: set_record_set ( $ params , $ records ) ; return $ record ; }
Finds and returns a grade_category instance based on params.

@param array $params associative arrays varname=>value
@return grade_category The retrieved grade_category instance or false if none found.
Finds and returns a grade_category instance based on params .