[ 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. param: string $query Query statement with optional sprintf()-like placeholders. param: mixed ...$args Optional arguments to pass to the GP_Thing::prepare() function. 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. |
value( $query, ...$args ) X-Ref |
Retrieves one variable from the database. param: string $query Query statement with optional sprintf()-like placeholders. param: mixed ...$args Optional arguments to pass to the GP_Thing::prepare() function. 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. |
prepare( $query, ...$args ) X-Ref |
Prepares a SQL query for safe execution. Uses sprintf()-like syntax. param: string $query Query statement with optional sprintf()-like placeholders. param: mixed ...$args Optional arguments to pass to the GP_Thing::prepare() function. 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. |
many( $query, ...$args ) X-Ref |
Retrieves an entire result set from the database, mapped to GP_Thing. param: string $query Query statement with optional sprintf()-like placeholders. param: mixed ...$args Optional arguments to pass to the GP_Thing::prepare() function. 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. |
many_no_map( $query, ...$args ) X-Ref |
Retrieves an entire result set from the database. param: string $query Query statement with optional sprintf()-like placeholders. param: mixed ...$args Optional arguments to pass to the GP_Thing::prepare() function. return: object[] Database query results. since: 1.0.0 since: 3.0.0 Added spread operator and require `$query` argument to be set. |
find_many( $conditions, $order = null ) X-Ref |
[find_many description] param: string|array $conditions param: string|array $order Optional. return: mixed since: 1.0.0 |
find_many_no_map( $conditions, $order = null ) X-Ref |
[find_many_no_map description] param: string|array $conditions param: string|array $order Optional. return: mixed since: 1.0.0 |
find_one( $conditions, $order = null ) X-Ref |
[find_one description] param: string|array $conditions param: string|array $order Optional. return: mixed since: 1.0.0 |
find( $conditions, $order = null ) X-Ref |
[find description] param: string|array $conditions param: string|array $order Optional. return: mixed since: 1.0.0 |
find_no_map( $conditions, $order = null ) X-Ref |
[find_no_map description] param: string|array $conditions param: string|array $order Optional. return: mixed since: 1.0.0 |
_no_map( $name, $args ) X-Ref |
[_no_map description] param: string $name Method name. param: mixed $args Method-dependent arguments. return: mixed since: 1.0.0 |
map_no_map( $results ) X-Ref |
[map_no_map description] param: mixed $results The results, unmapped. return: mixed since: 1.0.0 |
map( $results ) X-Ref |
Maps database results to their GP_Thing presentations. param: mixed $results The results from the database. return: GP_Thing[]|object[] If enabled, a list of objects mapped to GP_Thing. since: 1.0.0 |
query( $query, ...$args ) X-Ref |
Performs a database query. param: string $query Database query. param: mixed ...$args Optional arguments to pass to the prepare method. 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. |
create( $args ) X-Ref |
Inserts a new row param: $args array associative array with fields as keys and values as values return: mixed the object corresponding to the inserted row or false on error |
create_and_select( $args ) X-Ref |
Inserts a record and then selects it back based on the id param: $args array see create() return: mixed the selected object or false on error |
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. param: GP_Thing|int $thing_or_id ID of a thing or GP_Thing object. return: GP_Thing|false Thing object on success, false on failure. since: 1.0.0 |
save( $args = null ) X-Ref |
Saves an existing thing. param: mixed $args Values to update. return: bool|null Null and false on failure, true on success. since: 1.0.0 |
delete() X-Ref |
Deletes a single row since: 1.0.0 |
delete_all( $where = null ) X-Ref |
Deletes all or multiple rows 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. since: 1.0.0 |
delete_many( array $where ) X-Ref |
Deletes multiple rows param: array $where An array of conditions to use to for a SQL "where" clause, if not passed, no rows will be deleted. since: 2.0.0 |
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. param: array $args Arguments for 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. |
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. param: array|object $thing Data about the thing retrieved from the database. return: GP_Thing|false Thing object on success, false on failure. since: 1.0.0 |
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. param: GP_Thing $thing_before Object before the update. return: bool |
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` param: mixed $php_value The PHP value to convert to conditions. return: string SQL conditions. since: 1.0.0 |
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. param: GP_Validation_Rules $rules The validation rules instance. since: 1.0.0 |
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: Fri Dec 6 01:01:08 2024 | Cross-referenced by PHPXref 0.7.1 |