IStructure
in
Structure implementation for Real Media Library. It handles all SQL query which reads all folders from the database and "collects" it into one tree. You can modify the structure queries by RML/Tree* filters and extending the MatthiasWeb\RealMediaLibrary\attachment\Structure class (implements IStructure).
Tags
Table of Contents
Methods
- __construct() : mixed
- Start reading a structure. If you pass a $root parameter the parameter is not automatically respected. You should then use your own implementation or filters to respect the root. Use this constructor to add your filters and respect your custom Structure class implementation.
- byAbsolutePath() : IFolder|null
- Get a folder by absolute path.
- byId() : IFolder|null
- Get a folder by id.
- getCntAttachments() : int
- Get the attachment count for this structure.
- getCntRoot() : int
- Get the attachment count for the "Unorganized" folder for this structure.
- getData() : array<string|int, mixed>
- Get the custom data.
- getParsed() : array<string|int, IFolder>
- Get all SQL query results as IFolder objects.
- getPlainTree() : array<string|int, object>
- Get all SQL query results placed to a tree. It is fully resolved with all hierarchical plain objects of the folders expect the invisible nodes.
- getRows() : array<string|int, object>
- Get the SQL query result instead of IFolder objects.
- getTree() : array<string|int, IFolder>
- Get all SQL query results placed to a tree. That means it is a "hierarchical" result where you work with ->getChildren(). The first level contains the top folders.
- initialLoad() : mixed
- Checks, if the SQL result is available and load it if not.
- resetData() : mixed
- Resets the data of the structure.
- setData() : mixed
- Set the custom data.
Methods
__construct()
Start reading a structure. If you pass a $root parameter the parameter is not automatically respected. You should then use your own implementation or filters to respect the root. Use this constructor to add your filters and respect your custom Structure class implementation.
public
__construct([int $root = null ][, array<string|int, mixed> $data = null ]) : mixed
Parameters
- $root : int = null
-
The root folder defined for the structure
- $data : array<string|int, mixed> = null
-
Custom data for the structure
byAbsolutePath()
Get a folder by absolute path.
public
byAbsolutePath(string $path) : IFolder|null
Parameters
- $path : string
-
The path
Tags
Return values
IFolder|nullbyId()
Get a folder by id.
public
byId(int $id[, bool $nullForRoot = true ]) : IFolder|null
Parameters
- $id : int
-
The id of the folder
- $nullForRoot : bool = true
-
If set to false and $id == -1 then the Root instance is returned
Tags
Return values
IFolder|nullgetCntAttachments()
Get the attachment count for this structure.
public
getCntAttachments() : int
Return values
int —Count
getCntRoot()
Get the attachment count for the "Unorganized" folder for this structure.
public
getCntRoot() : int
Return values
int —Count
getData()
Get the custom data.
public
getData() : array<string|int, mixed>
Return values
array<string|int, mixed> —Data
getParsed()
Get all SQL query results as IFolder objects.
public
getParsed() : array<string|int, IFolder>
Return values
array<string|int, IFolder> —The folders
getPlainTree()
Get all SQL query results placed to a tree. It is fully resolved with all hierarchical plain objects of the folders expect the invisible nodes.
public
getPlainTree() : array<string|int, object>
Return values
array<string|int, object>getRows()
Get the SQL query result instead of IFolder objects.
public
getRows() : array<string|int, object>
Return values
array<string|int, object> —The SQL result
getTree()
Get all SQL query results placed to a tree. That means it is a "hierarchical" result where you work with ->getChildren(). The first level contains the top folders.
public
getTree() : array<string|int, IFolder>
Return values
array<string|int, IFolder> —The folders
initialLoad()
Checks, if the SQL result is available and load it if not.
public
initialLoad() : mixed
resetData()
Resets the data of the structure.
public
resetData([int $root = null ][, bool $fetchData = true ]) : mixed
Parameters
- $root : int = null
-
The root folder
- $fetchData : bool = true
-
Determine, if the data should be re-fetched
Tags
setData()
Set the custom data.
public
setData(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
-
The custom data