[ Index ] |
PHP Cross Reference of GlotPress |
[Source view] [Print] [Project Stats]
Things: GP_Thing class
File Size: | 769 lines (20 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
GP_Thing:: (50 methods):
__construct()
get_static()
has_static()
set_static()
all()
reload()
one()
value()
prepare()
many()
many_no_map()
find_many()
find_many_no_map()
find_one()
find()
find_no_map()
_no_map()
map_no_map()
map()
query()
create()
create_and_select()
update()
get()
save()
delete()
delete_all()
delete_many()
set_fields()
normalize_fields()
prepare_fields_for_save()
now_in_mysql_format()
prepare_fields_for_create()
get_db_field_formats()
coerce()
after_create()
after_save()
after_delete()
sql_condition_from_php_value()
sql_from_conditions()
sql_from_order()
select_all_from_conditions_and_order()
restrict_fields()
validate()
force_false_to_null()
fields()
sql_limit_for_paging()
found_rows()
like_escape_printf()
apply_default_conditions()
__construct( $fields = array() X-Ref |
No description |
get_static( $name, $default = null ) X-Ref |
No description |
has_static( $name ) X-Ref |
No description |
set_static( $name, $value ) X-Ref |
No description |
all( $order = null ) X-Ref |
Retrieves all rows from this table |
reload() X-Ref |
Reloads the object data from the database, based on its id return: GP_Thing Thing object. |
one( $query, ...$args ) X-Ref |
Retrieves one row from the database. return: GP_Thing|false Thing object on success, false on failure. since: 1.0.0 since: 3.0.0 Added spread operator and require `$query` argument to be set. param: string $query Query statement with optional sprintf()-like placeholders. param: mixed ...$args Optional arguments to pass to the GP_Thing::prepare() function. |
value( $query, ...$args ) X-Ref |
Retrieves one variable from the database. return: string|null Database query result (as string), or false on failure. since: 1.0.0 since: 3.0.0 Added spread operator and require `$query` argument to be set. param: string $query Query statement with optional sprintf()-like placeholders. param: mixed ...$args Optional arguments to pass to the GP_Thing::prepare() function. |
prepare( $query, ...$args ) X-Ref |
Prepares a SQL query for safe execution. Uses sprintf()-like syntax. return: string Sanitized query string, if there is a query to prepare. since: 1.0.0 since: 3.0.0 Added spread operator and require `$query` argument to be set. param: string $query Query statement with optional sprintf()-like placeholders. param: mixed ...$args Optional arguments to pass to the GP_Thing::prepare() function. |
many( $query, ...$args ) X-Ref |
Retrieves an entire result set from the database, mapped to GP_Thing. return: GP_Thing[] A list of GP_Thing objects. since: 1.0.0 since: 3.0.0 Added spread operator and require `$query` argument to be set. param: string $query Query statement with optional sprintf()-like placeholders. param: mixed ...$args Optional arguments to pass to the GP_Thing::prepare() function. |
many_no_map( $query, ...$args ) X-Ref |
Retrieves an entire result set from the database. return: object[] Database query results. since: 1.0.0 since: 3.0.0 Added spread operator and require `$query` argument to be set. param: string $query Query statement with optional sprintf()-like placeholders. param: mixed ...$args Optional arguments to pass to the GP_Thing::prepare() function. |
find_many( $conditions, $order = null ) X-Ref |
[find_many description] return: mixed since: 1.0.0 param: string|array $conditions param: string|array $order Optional. |
find_many_no_map( $conditions, $order = null ) X-Ref |
[find_many_no_map description] return: mixed since: 1.0.0 param: string|array $conditions param: string|array $order Optional. |
find_one( $conditions, $order = null ) X-Ref |
[find_one description] return: mixed since: 1.0.0 param: string|array $conditions param: string|array $order Optional. |
find( $conditions, $order = null ) X-Ref |
[find description] return: mixed since: 1.0.0 param: string|array $conditions param: string|array $order Optional. |
find_no_map( $conditions, $order = null ) X-Ref |
[find_no_map description] return: mixed since: 1.0.0 param: string|array $conditions param: string|array $order Optional. |
_no_map( $name, $args ) X-Ref |
[_no_map description] return: mixed since: 1.0.0 param: string $name Method name. param: mixed $args Method-dependent arguments. |
map_no_map( $results ) X-Ref |
[map_no_map description] return: mixed since: 1.0.0 param: mixed $results The results, unmapped. |
map( $results ) X-Ref |
Maps database results to their GP_Thing presentations. return: GP_Thing[]|object[] If enabled, a list of objects mapped to GP_Thing. since: 1.0.0 param: mixed $results The results from the database. |
query( $query, ...$args ) X-Ref |
Performs a database query. return: int|bool Number of rows affected/selected or false on error. since: 1.0.0 since: 3.0.0 Added spread operator and require `$query` argument to be set. param: string $query Database query. param: mixed ...$args Optional arguments to pass to the prepare method. |
create( $args ) X-Ref |
Inserts a new row return: mixed the object corresponding to the inserted row or false on error param: $args array associative array with fields as keys and values as values |
create_and_select( $args ) X-Ref |
Inserts a record and then selects it back based on the id return: mixed the selected object or false on error param: $args array see create() |
update( $data, $where = null ) X-Ref |
Updates a single row param: $data array associative array with fields as keys and updated values as values |
get( $thing_or_id ) X-Ref |
Retrieves an existing thing. return: GP_Thing|false Thing object on success, false on failure. since: 1.0.0 param: GP_Thing|int $thing_or_id ID of a thing or GP_Thing object. |
save( $args = null ) X-Ref |
Saves an existing thing. return: bool|null Null and false on failure, true on success. since: 1.0.0 param: mixed $args Values to update. |
delete() X-Ref |
Deletes a single row since: 1.0.0 |
delete_all( $where = null ) X-Ref |
Deletes all or multiple rows since: 1.0.0 param: array $where An array of conditions to use to for a SQL "where" clause, if null, not used and all matching rows will be deleted. |
delete_many( array $where ) X-Ref |
Deletes multiple rows since: 2.0.0 param: array $where An array of conditions to use to for a SQL "where" clause, if not passed, no rows will be deleted. |
set_fields( $fields ) X-Ref |
Sets fields of the current GP_Thing object. param: array $fields Fields for a GP_Thing object. |
normalize_fields( $args ) X-Ref |
Normalizes an array with key-value pairs representing a GP_Thing object. return: array Normalized arguments for a GP_Thing object. since: 1.0.0 since: 3.0.0 Normalizes int fields to be integers. param: array $args Arguments for a GP_Thing object. |
prepare_fields_for_save( $args ) X-Ref |
Prepares for enetering the database an array with key-value pairs, preresenting a GP_Thing object. |
now_in_mysql_format() X-Ref |
No description |
prepare_fields_for_create( $args ) X-Ref |
No description |
get_db_field_formats( $args ) X-Ref |
No description |
coerce( $thing ) X-Ref |
Coerces data to being a thing object. return: GP_Thing|false Thing object on success, false on failure. since: 1.0.0 param: array|object $thing Data about the thing retrieved from the database. |
after_create() X-Ref |
Is called after an object is created in the database. This is a placeholder function which should be implemented in the child classes. return: bool |
after_save( $thing_before ) X-Ref |
Is called after an object is saved to the database. This is a placeholder function which should be implemented in the child classes. return: bool param: GP_Thing $thing_before Object before the update. |
after_delete() X-Ref |
Is called after an object is deleted from the database. This is a placeholder function which should be implemented in the child classes. return: bool |
sql_condition_from_php_value( $php_value ) X-Ref |
Builds SQL conditions from a PHP value. Examples: Input: `null` Output: `IS NULL` Input: `'foo'` Output: `= 'foo'` Input: `1` or `'1'` Output: `= 1` return: string SQL conditions. since: 1.0.0 param: mixed $php_value The PHP value to convert to conditions. |
sql_from_conditions( $conditions ) X-Ref |
No description |
sql_from_order( $order_by, $order_how = '' ) X-Ref |
No description |
select_all_from_conditions_and_order( $conditions, $order = null ) X-Ref |
No description |
restrict_fields( $rules ) X-Ref |
Sets restriction rules for fields. since: 1.0.0 param: GP_Validation_Rules $rules The validation rules instance. |
validate() X-Ref |
No description |
force_false_to_null( $value ) X-Ref |
No description |
fields() X-Ref |
No description |
sql_limit_for_paging( $page, $per_page = null ) X-Ref |
No description |
found_rows() X-Ref |
No description |
like_escape_printf( $s ) X-Ref |
No description |
apply_default_conditions( $conditions_str ) X-Ref |
No description |
Generated: Sat Dec 21 01:01:08 2024 | Cross-referenced by PHPXref 0.7.1 |