class db_support extends facade mixin db_support

Facade for local_middag\framework\support\moodle\db_support.

Properties

static protected array<string,object> $resolved_instances

The resolved object instances (cached roots).

from  abstract_facade
static protected bool $cached

Indicates if resolved instances should be cached.

from  abstract_facade

Methods

static mixed
__callStatic(string $method, array $args)

Dynamically handle static method calls on the facade proxy.

static string
get_facade_accessor()

Return the service accessor key for this facade.

static object
get_facade_root()

Get the root object behind the facade.

static void
swap(object $instance)

Swap a given instance for testing or runtime overriding.

static void
clear_resolved_instance(string $name)

Clear one cached facade instance.

static void
clearresolved_instances()

Clear all cached facade instances.

static void
disable_cache()

Disable instance caching (useful for testing).

static void
enable_cache()

Enable instance caching.

static void
reset()

Reset the facade: clear cache and re-enable caching.

static object
resolve_facade_instance(string $name)

Resolve the instance from the Kernel container.

void
static() $\stdClass get_record(string $table, array $conditions, string $fields = '*', int $strictness = IGNORE_MISSING)

No description

static mixed
get_field(string $table, string $return, array $conditions, int $strictness = IGNORE_MISSING)

No description

static mixed
get_field_sql(string $sql, ?array $params = null)

No description

static array
get_records(string $table, array $conditions = [], string $sort = '', string $fields = '*', int $limitfrom, int $limitnum)

No description

static array
get_records_sql(string $sql, ?array $params = null, int $limitfrom, int $limitnum)

No description

static int
insert_record(string $table, stdClass $dataobject, bool $returnid = true, bool $bulk = false)

No description

static bool
update_record(string $table, stdClass $dataobject, bool $bulk = false)

No description

static bool
delete_records(string $table, array $conditions = [])

No description

static bool
record_exists(string $table, array $conditions)

No description

static moodle_transaction
start_delegated_transaction()

No description

static bool
execute(string $sql, ?array $params = null)

No description

static string
sql_fullname(string $firstname = 'firstname', string $lastname = 'lastname')

No description

static string
sql_like(string $field, string $param, bool $casesensitive = true, bool $accentsensitive = true, bool $notlike = false, string $escapechar = '\\')

No description

static array
get_in_or_equal(mixed $items, int $type = SQL_PARAMS_NAMED, string $prefix = 'p', bool $equal = true, mixed $onemptyitems = false)

No description

static array
get_records_menu(string $table, array $conditions = [], string $sort = '', string $fields = '*')

No description

static moodle_recordset
get_recordset_sql(string $sql, ?array $params = null, int $limitfrom, int $limitnum)

No description

static string
sql_compare_text(string $fieldname)

No description

static int
count_records(string $table, array $conditions = [])

No description

Details

in abstract_facade at line 62
static mixed __callStatic(string $method, array $args)

Dynamically handle static method calls on the facade proxy.

Parameters

string $method
array $args

Return Value

mixed

Exceptions

BadMethodCallException
RuntimeException

at line 53
static string get_facade_accessor()

Return the service accessor key for this facade.

Return Value

string

the service ID or class name

in abstract_facade at line 94
static object get_facade_root()

Get the root object behind the facade.

Return Value

object

in abstract_facade at line 104
static void swap(object $instance)

Swap a given instance for testing or runtime overriding.

Parameters

object $instance

Return Value

void

in abstract_facade at line 118
static void clear_resolved_instance(string $name)

Clear one cached facade instance.

Parameters

string $name

Return Value

void

in abstract_facade at line 126
static void clearresolved_instances()

Clear all cached facade instances.

Return Value

void

in abstract_facade at line 134
static void disable_cache()

Disable instance caching (useful for testing).

Return Value

void

in abstract_facade at line 143
static void enable_cache()

Enable instance caching.

Return Value

void

in abstract_facade at line 151
static void reset()

Reset the facade: clear cache and re-enable caching.

Return Value

void

in abstract_facade at line 168
static protected object resolve_facade_instance(string $name)

Resolve the instance from the Kernel container.

Parameters

string $name

service identifier or class name registered in the container

Return Value

object

Exceptions

RuntimeException

at line 48
void static() $\stdClass get_record(string $table, array $conditions, string $fields = '*', int $strictness = IGNORE_MISSING)

No description

Parameters

) $\stdClass get_record(string $table
array $conditions
string $fields
int $strictness

Return Value

void

at line 48
static mixed get_field(string $table, string $return, array $conditions, int $strictness = IGNORE_MISSING)

No description

Parameters

string $table
string $return
array $conditions
int $strictness

Return Value

mixed

at line 48
static mixed get_field_sql(string $sql, ?array $params = null)

No description

Parameters

string $sql
?array $params

Return Value

mixed

at line 48
static array get_records(string $table, array $conditions = [], string $sort = '', string $fields = '*', int $limitfrom, int $limitnum)

No description

Parameters

string $table
array $conditions
string $sort
string $fields
int $limitfrom
int $limitnum

Return Value

array

at line 48
static array get_records_sql(string $sql, ?array $params = null, int $limitfrom, int $limitnum)

No description

Parameters

string $sql
?array $params
int $limitfrom
int $limitnum

Return Value

array

at line 48
static int insert_record(string $table, stdClass $dataobject, bool $returnid = true, bool $bulk = false)

No description

Parameters

string $table
stdClass $dataobject
bool $returnid
bool $bulk

Return Value

int

at line 48
static bool update_record(string $table, stdClass $dataobject, bool $bulk = false)

No description

Parameters

string $table
stdClass $dataobject
bool $bulk

Return Value

bool

at line 48
static bool delete_records(string $table, array $conditions = [])

No description

Parameters

string $table
array $conditions

Return Value

bool

at line 48
static bool record_exists(string $table, array $conditions)

No description

Parameters

string $table
array $conditions

Return Value

bool

at line 48
static moodle_transaction start_delegated_transaction()

No description

Return Value

moodle_transaction

at line 48
static bool execute(string $sql, ?array $params = null)

No description

Parameters

string $sql
?array $params

Return Value

bool

at line 48
static string sql_fullname(string $firstname = 'firstname', string $lastname = 'lastname')

No description

Parameters

string $firstname
string $lastname

Return Value

string

at line 48
static string sql_like(string $field, string $param, bool $casesensitive = true, bool $accentsensitive = true, bool $notlike = false, string $escapechar = '\\')

No description

Parameters

string $field
string $param
bool $casesensitive
bool $accentsensitive
bool $notlike
string $escapechar

Return Value

string

at line 48
static array get_in_or_equal(mixed $items, int $type = SQL_PARAMS_NAMED, string $prefix = 'p', bool $equal = true, mixed $onemptyitems = false)

No description

Parameters

mixed $items
int $type
string $prefix
bool $equal
mixed $onemptyitems

Return Value

array

at line 48
static array get_records_menu(string $table, array $conditions = [], string $sort = '', string $fields = '*')

No description

Parameters

string $table
array $conditions
string $sort
string $fields

Return Value

array

at line 48
static moodle_recordset get_recordset_sql(string $sql, ?array $params = null, int $limitfrom, int $limitnum)

No description

Parameters

string $sql
?array $params
int $limitfrom
int $limitnum

Return Value

moodle_recordset

at line 48
static string sql_compare_text(string $fieldname)

No description

Parameters

string $fieldname

Return Value

string

at line 48
static int count_records(string $table, array $conditions = [])

No description

Parameters

string $table
array $conditions

Return Value

int