protected static function fetch_helper($table, $classname, $params) {
        if ($instances = self::fetch_all_helper($table, $classname, $params)) {
            if (count($instances) > 1) {
                // we should not tolerate any errors here - problems might appear later
                print_error('morethanonerecordinfetch','debug');
            }
            return reset($instances);
        } else {
            return false;
        }
    }
protected static function fetch_helper($table, $classname, $params) {
        if ($instances = self::fetch_all_helper($table, $classname, $params)) {
            if (count($instances) > 1) {
                // we should not tolerate any errors here - problems might appear later
                print_error('morethanonerecordinfetch','debug');
            }
            return reset($instances);
        } else {
            return false;
        }
    }
protected static function fetch_helper ( $ table , $ classname , $ params ) { if ( $ instances = self :: fetch_all_helper ( $ table , $ classname , $ params ) ) { if ( count ( $ instances ) > 1 ) { // we should not tolerate any errors here - problems might appear later print_error ( 'morethanonerecordinfetch' , 'debug' ) ; } return reset ( $ instances ) ; } else { return false ; } }
Factory method - uses the parameters to retrieve matching instance from the DB.

@final
@param string $table The table name to fetch from
@param string $classname The class that you want the result instantiated as
@param array $params Any params required to select the desired row
@return object Instance of $classname or false.
Factory method - uses the parameters to retrieve matching instance from the DB .