Core class used to implement the glossary entries.
| since | 1.0.0 | 
|---|---|
| package | GlotPress | 
| inherited_from | \GP_Thing | 
__construct($fields = array()) 
| inherited_from | \GP_Thing::__construct() | 
|---|
__construct($fields = array()) 
after_create() : boolean
This is a placeholder function which should be implemented in the child classes.
booleanafter_delete() : boolean
This is a placeholder function which should be implemented in the child classes.
booleanafter_save(\GP_Thing $thing_before) : boolean
This is a placeholder function which should be implemented in the child classes.
\GP_ThingObject before the update.
booleanall($order = null) 
apply_default_conditions($conditions_str)
by_glossary_id($glossary_id)
coerce(array|object $thing) : \GP_Thing | false
| since | 1.0.0 | 
|---|
arrayobjectData about the thing retrieved from the database.
\GP_ThingfalseThing object on success, false on failure.create($args) : mixed
array associative array with fields as keys and values as values
mixedthe object corresponding to the inserted row or false on errorcreate_and_select($args) : mixed
array see create()
mixedthe selected object or false on errordelete()
| since | 1.0.0 | 
|---|
delete_all(array $where = null) 
| since | 1.0.0 | 
|---|
arrayAn 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)
| since | 2.0.0 | 
|---|
arrayAn array of conditions to use to for a SQL "where" clause, if not passed, no rows will be deleted.
fields()
find(string|array $conditions, string|array $order = null) : mixed
| since | 1.0.0 | 
|---|
stringarray
stringarrayOptional.
mixedfind_many(string|array $conditions, string|array $order = null) : mixed
| since | 1.0.0 | 
|---|
stringarray
stringarrayOptional.
mixedfind_many_no_map(string|array $conditions, string|array $order = null) : mixed
| since | 1.0.0 | 
|---|
stringarray
stringarrayOptional.
mixedfind_no_map(string|array $conditions, string|array $order = null) : mixed
| since | 1.0.0 | 
|---|
stringarray
stringarrayOptional.
mixedfind_one(string|array $conditions, string|array $order = null) : mixed
| since | 1.0.0 | 
|---|
stringarray
stringarrayOptional.
mixedforce_false_to_null($value)
found_rows()
get(\GP_Thing|integer $thing_or_id) : \GP_Thing | false
| since | 1.0.0 | 
|---|
\GP_ThingintegerID of a thing or GP_Thing object.
\GP_ThingfalseThing object on success, false on failure.get_db_field_formats($args)
get_static($name, $default = null) 
has_static($name)
key() : string
| since | 2.3.0 | 
|---|
stringThe keylast_modified(\GP_Glossary $glossary) : string
| since | 1.0.0 | 
|---|
\GP_GlossaryThe glossary to retrieve the last modified date.
stringThe last modified date on success, empty string on failure.like_escape_printf($s)
many(string $query, mixed $args) : array<mixed,\GP_Thing>
| since | 1.0.0 | 
|---|---|
| since | 3.0.0 Added spread operator and require `$query` argument to be set. | 
| see | |
| see | 
stringQuery statement with optional sprintf()-like placeholders.
mixedOptional arguments to pass to the GP_Thing::prepare() function.
array<mixed,\GP_Thing>A list of GP_Thing objects.many_no_map(string $query, mixed $args) : array<mixed,object>
| since | 1.0.0 | 
|---|---|
| since | 3.0.0 Added spread operator and require `$query` argument to be set. | 
| see | |
| see | 
stringQuery statement with optional sprintf()-like placeholders.
mixedOptional arguments to pass to the GP_Thing::prepare() function.
array<mixed,object>Database query results.map(mixed $results) : array<mixed,\GP_Thing> | array<mixed,object>
| since | 1.0.0 | 
|---|
mixedThe results from the database.
array<mixed,\GP_Thing>array<mixed,object>If enabled, a list of objects mapped to GP_Thing.map_no_map(mixed $results) : mixed
| since | 1.0.0 | 
|---|
mixedThe results, unmapped.
mixednormalize_fields(array $args) : array
| todo | Include default type handling. For example dates 0000-00-00 should be set to null | 
|---|---|
| since | 1.0.0 | 
| since | 3.0.0 Normalizes int fields to be integers. | 
arrayArguments for a GP_Thing object.
arrayNormalized arguments for a GP_Thing object.now_in_mysql_format()
one(string $query, mixed $args) : \GP_Thing | false
| since | 1.0.0 | 
|---|---|
| since | 3.0.0 Added spread operator and require `$query` argument to be set. | 
| see | |
| see | 
stringQuery statement with optional sprintf()-like placeholders.
mixedOptional arguments to pass to the GP_Thing::prepare() function.
\GP_ThingfalseThing object on success, false on failure.prepare(string $query, mixed $args) : string
| since | 1.0.0 | 
|---|---|
| since | 3.0.0 Added spread operator and require `$query` argument to be set. | 
| see | 
stringQuery statement with optional sprintf()-like placeholders.
mixedOptional arguments to pass to the GP_Thing::prepare() function.
stringSanitized query string, if there is a query to prepare.prepare_fields_for_create($args)
prepare_fields_for_save($args)
query(string $query, mixed $args) : integer | boolean
reload() : \GP_Thing
\GP_ThingThing object.restrict_fields(\GP_Validation_Rules $rules)
| since | 1.0.0 | 
|---|---|
| inherited_from | \GP_Thing::restrict_fields() | 
\GP_Validation_RulesThe validation rules instance.
restrict_fields(\GP_Validation_Rules $rules)
| since | 1.0.0 | 
|---|
\GP_Validation_RulesThe validation rules instance.
save(mixed $args = null) : boolean | null
| since | 1.0.0 | 
|---|
mixedValues to update.
booleannullNull and false on failure, true on success.select_all_from_conditions_and_order($conditions, $order = null) 
set_fields(array $fields)
arrayFields for a GP_Thing object.
set_static($name, $value)
sql_condition_from_php_value(mixed $php_value) : string
Examples:
Input: null
Output: IS NULL
Input: 'foo'
Output: = 'foo'
Input: 1 or '1'
Output: = 1
| since | 1.0.0 | 
|---|
mixedThe PHP value to convert to conditions.
stringSQL conditions.sql_from_conditions($conditions)
sql_from_order($order_by, $order_how = '') 
sql_limit_for_paging($page, $per_page = null) 
update($data, $where = null) 
array associative array with fields as keys and updated values as values
validate()
value(string $query, mixed $args) : string | null
| since | 1.0.0 | 
|---|---|
| since | 3.0.0 Added spread operator and require `$query` argument to be set. | 
| see | |
| see | 
stringQuery statement with optional sprintf()-like placeholders.
mixedOptional arguments to pass to the GP_Thing::prepare() function.
stringnullDatabase query result (as string), or false on failure._no_map(string $name, mixed $args) : mixed
| since | 1.0.0 | 
|---|
stringMethod name.
mixedMethod-dependent arguments.
mixedsetup_pos()
$class
$date_modified
$default_conditions
$errors
array()$field_names
array('id', 'glossary_id', 'term', 'part_of_speech', 'comment', 'translation', 'date_modified', 'last_edited_by')| inherited_from | \GP_Thing::field_names | 
|---|
$field_names
array()$glossary_id
$id
| inherited_from | \GP_Thing::id | 
|---|
$id
$int_fields
array('id', 'glossary_id', 'last_edited_by')| inherited_from | \GP_Thing::int_fields | 
|---|
$int_fields
array()$last_edited_by
$map_results
true$non_db_field_names
array()$non_updatable_attributes
array('id')| inherited_from | \GP_Thing::non_updatable_attributes | 
|---|
$non_updatable_attributes
$part_of_speech
$parts_of_speech
array()$per_page
30$static
array()$static_by_class
array()$table
null$table_basename
'gp_glossary_entries'| inherited_from | \GP_Thing::table_basename | 
|---|
$table_basename
$term
$translation
$validation_rules
null$validation_rules_by_class
array()
$comment
Default