Function __global->_selectcode_subtree_fetch
Definitions
sources/selectcode.php
- Helper function to fetch a subtree from the database.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: array
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $look_under | string | No | No | required parameter | N/A | N/A | The category-ID we are searching under |
| $table_name | ?string | No | No | required parameter | N/A | N/A | The database's table that contains parent/child relationships in the record-set's category-set (the category-set is equal to the record-set if we're matching categories, but not if we're matching entries) (null: don't support subtree [*-style] searches) |
| $parent_name | ?string | No | No | required parameter | N/A | N/A | The database's field name for the category-set's parent-category-ID (null: don't support subtree [*-style] searches beyond the tree base) |
| $field_name | string | No | No | required parameter | N/A | N/A | The database's field name for the category-set's category-ID |
| $numeric_ids | boolean | No | No | required parameter | N/A | N/A | Whether the category-set IDs are numeric |
| $db | object | No | No | required parameter | N/A | N/A | Database connector to use |
| &$cached_mappings | ?array | Yes | No | required parameter | N/A | N/A | A place to store cached data we've already loaded once in this function. Pass in an null variable (not a null literal) (null: none yet) |
| $first | boolean | No | No | True | N/A | N/A | Whether this is the base call to this recursive function (just leave it as the default, true) |
| $recurse | boolean | No | No | True | N/A | N/A | Whether to run recursively |
Returns
- Subtree: list of IDs in category-set
- Type: array
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Helper function to fetch a subtree from the database.
*
* @param string $look_under The category-ID we are searching under
* @param ?string $table_name The database's table that contains parent/child relationships in the record-set's category-set (the category-set is equal to the record-set if we're matching categories, but not if we're matching entries) (null: don't support subtree [*-style] searches)
* @param ?string $parent_name The database's field name for the category-set's parent-category-ID (null: don't support subtree [*-style] searches beyond the tree base)
* @param string $field_name The database's field name for the category-set's category-ID
* @param boolean $numeric_ids Whether the category-set IDs are numeric
* @param object $db Database connector to use
* @param ?array $cached_mappings A place to store cached data we've already loaded once in this function. Pass in an null variable (not a null literal) (null: none yet)
* @param boolean $first Whether this is the base call to this recursive function (just leave it as the default, true)
* @param boolean $recurse Whether to run recursively
* @return array Subtree: list of IDs in category-set
*/
function _selectcode_subtree_fetch(string $look_under, ?string $table_name, ?string $parent_name, string $field_name, bool $numeric_ids, object $db, ?array &$cached_mappings, bool $first = true, bool $recurse = true) : array
* Helper function to fetch a subtree from the database.
*
* @param string $look_under The category-ID we are searching under
* @param ?string $table_name The database's table that contains parent/child relationships in the record-set's category-set (the category-set is equal to the record-set if we're matching categories, but not if we're matching entries) (null: don't support subtree [*-style] searches)
* @param ?string $parent_name The database's field name for the category-set's parent-category-ID (null: don't support subtree [*-style] searches beyond the tree base)
* @param string $field_name The database's field name for the category-set's category-ID
* @param boolean $numeric_ids Whether the category-set IDs are numeric
* @param object $db Database connector to use
* @param ?array $cached_mappings A place to store cached data we've already loaded once in this function. Pass in an null variable (not a null literal) (null: none yet)
* @param boolean $first Whether this is the base call to this recursive function (just leave it as the default, true)
* @param boolean $recurse Whether to run recursively
* @return array Subtree: list of IDs in category-set
*/
function _selectcode_subtree_fetch(string $look_under, ?string $table_name, ?string $parent_name, string $field_name, bool $numeric_ids, object $db, ?array &$cached_mappings, bool $first = true, bool $recurse = true) : array

