DatabaseTreeCache
in package
Table of Contents
Properties
- $cache : array<string|int, mixed>
- $cacheDir : string
- Tree cache directory.
- $database : Database
- $filesystem : Filesystem
- $framework : ContaoFramework
- $requestStack : RequestStack
- $parameterBag : ParameterBagInterface
- $utils : Utils
Methods
- __construct() : mixed
- addConfigToTreeCache() : mixed
- generateAllCacheTree() : mixed
- Generate all cache trees.
- generateCacheTree() : array<string|int, mixed>
- Generate the flat cache tree.
- getChildRecords() : array<string|int, mixed>
- Get all child records for given parent entities.
- getParentRecords() : array<string|int, mixed>
- Get all parent records for given child entity.
- getTreeCache() : array<string|int, mixed>|null
- Get the tree cache for a given table and key.
- loadDataContainer() : void
- Generate tree cache.
- purgeCacheTree() : mixed
- Purge the tree cache completely in order to take table relations into consideration.
- registerDcaToCacheTree() : bool
- Register a dca to the tree cache.
- isCompleteInstallation() : mixed
Properties
$cache
protected
static array<string|int, mixed>
$cache
= []
$cacheDir
Tree cache directory.
protected
string
$cacheDir
$database
protected
Database
$database
$filesystem
protected
Filesystem
$filesystem
$framework
protected
ContaoFramework
$framework
$requestStack
protected
RequestStack
$requestStack
$parameterBag
private
ParameterBagInterface
$parameterBag
$utils
private
Utils
$utils
Methods
__construct()
public
__construct(ContaoFramework $framework, Filesystem $filesystem, RequestStack $requestStack, ParameterBagInterface $parameterBag, Utils $utils) : mixed
Parameters
- $framework : ContaoFramework
- $filesystem : Filesystem
- $requestStack : RequestStack
- $parameterBag : ParameterBagInterface
- $utils : Utils
addConfigToTreeCache()
public
addConfigToTreeCache(string $table, string $key[, array<string|int, mixed> $config = [] ]) : mixed
Parameters
- $table : string
- $key : string
- $config : array<string|int, mixed> = []
generateAllCacheTree()
Generate all cache trees.
public
generateAllCacheTree(mixed $cacheDir) : mixed
Parameters
- $cacheDir : mixed
generateCacheTree()
Generate the flat cache tree.
public
generateCacheTree(string $table[, array<string|int, mixed> $ids = [] ][, string $key = 'id' ][, array<string|int, mixed> $config = [] ][, array<string|int, mixed> $return = [] ]) : array<string|int, mixed>
Parameters
- $table : string
-
The database table
- $ids : array<string|int, mixed> = []
-
Root identifiers (parent ids)
- $key : string = 'id'
-
Custom index key (default: primary key from model)
- $config : array<string|int, mixed> = []
-
Tree config
- $return : array<string|int, mixed> = []
-
Internal return array
Return values
array<string|int, mixed> —The flat cache tree
getChildRecords()
Get all child records for given parent entities.
public
getChildRecords(string $table[, array<string|int, mixed> $ids = [] ][, int $maxLevels = null ][, string $key = 'id' ][, array<string|int, mixed> $children = [] ][, int $level = 0 ]) : array<string|int, mixed>
Parameters
- $table : string
-
The database table
- $ids : array<string|int, mixed> = []
-
The parent entity ids
- $maxLevels : int = null
-
The max stop level
- $key : string = 'id'
- $children : array<string|int, mixed> = []
-
Internal children return array
- $level : int = 0
-
Internal depth attribute
Return values
array<string|int, mixed> —An array containing all children for given parent entities
getParentRecords()
Get all parent records for given child entity.
public
getParentRecords(string $table, int $id[, int $maxLevels = null ][, string $key = 'id' ][, array<string|int, mixed> $parents = [] ][, int $level = 0 ]) : array<string|int, mixed>
Parameters
- $table : string
-
The database table
- $id : int
-
The current entity id
- $maxLevels : int = null
-
The max stop level
- $key : string = 'id'
- $parents : array<string|int, mixed> = []
-
Internal children return array
- $level : int = 0
-
Internal depth attribute
Return values
array<string|int, mixed> —An array containing all children for given parent entities
getTreeCache()
Get the tree cache for a given table and key.
public
getTreeCache(string $table, mixed $key) : array<string|int, mixed>|null
Parameters
- $table : string
-
The database table
- $key : mixed
Return values
array<string|int, mixed>|nullloadDataContainer()
Generate tree cache.
public
loadDataContainer(mixed $table) : void
Parameters
- $table : mixed
purgeCacheTree()
Purge the tree cache completely in order to take table relations into consideration.
public
purgeCacheTree() : mixed
registerDcaToCacheTree()
Register a dca to the tree cache.
public
registerDcaToCacheTree(string $table[, array<string|int, mixed> $columns = [] ][, array<string|int, mixed> $values = [] ][, array<string|int, mixed> $options = [] ][, string $key = 'id' ]) : bool
Parameters
- $table : string
-
(The dca table)
- $columns : array<string|int, mixed> = []
-
Parent sql filter columns (e.g.
tl_page.type
) - $values : array<string|int, mixed> = []
-
Parent sql filter values (e.g.
root
fortl_page.type
) - $options : array<string|int, mixed> = []
-
SQL Options for sorting
- $key : string = 'id'
Return values
bool —Acknowledge state if register succeeded
isCompleteInstallation()
private
isCompleteInstallation(mixed $table) : mixed
Parameters
- $table : mixed