Метод | Описание | |
---|---|---|
__construct ( Gdn_SQLDriver $sql = null, Gdn_Cache $cache = null ) | Initialize a new instance of the {@link CategoryCollection} class. | |
flattenTree ( array $categories ) : array | Flatten a tree that was returned from {@link getTree}. | |
flushCache ( ) | Flush the entire category cache. | |
get ( integer $categoryID ) : array | null | Lookup a category by either ID or slug. | |
getAncestors ( integer | string $categoryID, boolean $includeHeadings = false ) : array | Get all of the ancestor categories above this one. | |
getByUrlCode ( string $code ) : array | null | Lookup a category by its URL slug. | |
getChildren ( integer $categoryID ) : array | Get the children of a category. | |
getConfig ( ) : Gdn_Configuration | Get the config. | |
getMulti ( array $categoryIDs ) : array | Get several categories by ID. | |
getStaticCalculator ( ) : callable | Get the calculator. | |
getTree ( integer $parentID, array $options = [] ) : array | Get all of the categories from a root. | |
getUserCalculator ( ) : callable | Get the dynamic calculator. | |
insert ( array $category ) | Insert a new category, handling its tree properties and caching. | |
refreshCache ( integer $categoryID ) : boolean | Refresh a category in the cache from the database. | |
setConfig ( Gdn_Configuration $config ) : CategoryCollection | Set the config. | |
setStaticCalculator ( callable $staticCalculator ) : CategoryCollection | Set the calculator. | |
setUserCalculator ( callable $userCalculator ) : CategoryCollection | Set the dynamic calculator. | |
update ( array $category ) : boolean | Update an existing category, handling its tree properties and caching. |
Метод | Описание | |
---|---|---|
cacheKey ( string $type, string | integer $id ) : string | Generate a full cache key. | |
calculateDynamic ( &$category ) | Calculate request-specific data on a category. | |
calculateStatic ( &$category ) | Calculate static data on a category. | |
calculateTreeCounts ( array &$categories ) | Calculate aggregate tree counts. | |
config ( string $key, mixed $default = null ) : mixed | Get a value from the config. | |
defaultCalculator ( &$category ) | Calculate dynamic data on a category. | |
flattenTreeInternal ( array $category, array &$result ) | Internal implementation support for {@link CategoryCollection::flattenTree()}. | |
getCacheInc ( ) | Get the cache increment. | |
getChildrenByParents ( array $parentIDs, string $permission = 'PermsDiscussionsView' ) : array | Get all of the children of a parent category. | |
getSchema ( ) : Gdn_Schema | Get the schema. |
public __construct ( Gdn_SQLDriver $sql = null, Gdn_Cache $cache = null ) | ||
$sql | Gdn_SQLDriver | The database layer dependency. |
$cache | Gdn_Cache | The cache layer dependency. |
public flattenTree ( array $categories ) : array | ||
$categories | array | The array of root categories. |
Результат | array | Returns an array of categories. |
public getChildren ( integer $categoryID ) : array | ||
$categoryID | integer | The category to get the children for. |
Результат | array | Returns an array of categories. |
public getConfig ( ) : Gdn_Configuration | ||
Результат | Gdn_Configuration | Returns the config. |
public getStaticCalculator ( ) : callable | ||
Результат | callable | Returns the calculator. |
public getTree ( integer $parentID, array $options = [] ) : array | ||
$parentID | integer | The ID of the parent category. |
$options | array | An array of options to affect the fetching. - maxdepth: The maximum depth of the tree. - collapsed: Stop when looking at a category of a certain type. - permission: The permission to use when looking at the tree. |
Результат | array |
public getUserCalculator ( ) : callable | ||
Результат | callable | Returns the dynamicCalculator. |
public refreshCache ( integer $categoryID ) : boolean | ||
$categoryID | integer | The category to refresh. |
Результат | boolean | Returns **true** if the category was refreshed or **false** otherwise. |
public setConfig ( Gdn_Configuration $config ) : CategoryCollection | ||
$config | Gdn_Configuration | The config. |
Результат | CategoryCollection | Returns `$this` for fluent calls. |
public setStaticCalculator ( callable $staticCalculator ) : CategoryCollection | ||
$staticCalculator | callable | The new calculator. |
Результат | CategoryCollection | Returns `$this` for fluent calls. |
public setUserCalculator ( callable $userCalculator ) : CategoryCollection | ||
$userCalculator | callable | The new dynamic calculator. |
Результат | CategoryCollection | Returns `$this` for fluent calls. |