TreeDatabaseTiein: ezcTreeDb
[ ]
[ ]
[ ]
[ ]
[ ]
Class: ezcTreeDb
|
ezcTreeDb contains common methods for the different database tree backends. [
source]
Parents
ezcTree
|
--ezcTreeDb
Descendents
| Child Class |
Description |
| ezcTreeDbParentChild |
ezcTreeDbParentChild implements a tree backend which stores parent/child information in a simple table containing the node's ID and its parent's ID.
|
| ezcTreeDbMaterializedPath |
ezcTreeDbMaterializedPath implements a tree backend which stores parent/child information in a path like string (such as /1/4/6/8).
|
Properties
|
string |
read/write
|
$nodeClassName
Which class is used as tree node - this class *must* inherit the ezcTreeNode class. |
|
ezcTreeDbDataStore |
read
|
$store
The data store that is used for retrieving/storing data. |
Member Variables
|
protected ezcDbHandler |
$dbh
Contains the database connection handler. |
|
protected string |
$indexTableName
Contains the name of the table to retrieve the relational data from. |
Inherited Member Variables
From
ezcTree:
Method Summary
|
public ezcTreeDb |
__construct(
$dbh, $indexTableName, $store )
Constructs a new ezcTreeDb object. |
|
protected abstract ezcQueryInsert |
createAddEmptyNodeQuery(
)
Creates the query to insert an empty node into the database, so that the last-inserted ID can be obtained. |
|
protected ezcQuery |
createAddNodeQuery(
$id )
Creates the query to insert/update an empty node in the database. |
|
public ezcTreeNode |
fetchParent(
$id )
Returns the parent node of the node with ID $id. |
|
protected integer |
generateNodeID(
)
This method generates the next node ID. |
|
protected string |
getParentId(
$childId )
Returns the ID of parent of the node with ID $childId. |
|
public ezcTreeNode |
getRootNode(
)
Returns the root node. |
|
public bool |
nodeExists(
$id )
Returns whether the node with ID $id exists as tree node. |
Inherited Methods
From
ezcTree :
Methods
__construct
Constructs a new ezcTreeDb object.
The different arguments to the constructor configure which database connection ($dbh) is used to access the database and the $indexTableName argument which table is used to retrieve the relation data from. The $store argument configure which data store is used with this tree.
All database backends require the index table to at least define the field 'id', which can either be a string or an integer field.
Parameters
Redefined in descendants as
createAddEmptyNodeQuery
Creates the query to insert an empty node into the database, so that the last-inserted ID can be obtained.
Redefined in descendants as
createAddNodeQuery
ezcQuery createAddNodeQuery(
mixed
$id )
Creates the query to insert/update an empty node in the database.
The query is constructed for the child with ID $id
Parameters
| Name |
Type |
Description |
$id |
mixed |
|
fetchParent
Returns the parent node of the node with ID $id.
This method returns null if there is no parent node.
Parameters
| Name |
Type |
Description |
$id |
string |
|
Redefinition of
generateNodeID
integer generateNodeID(
)
This method generates the next node ID.
It does so by inserting a new empty node into the database, and uses lastInsertId() to obtain the ID for the newly inserted node.
Redefinition of
getParentId
string getParentId(
string
$childId )
Returns the ID of parent of the node with ID $childId.
Parameters
| Name |
Type |
Description |
$childId |
string |
|
getRootNode
Returns the root node.
This methods returns null if there is no root node.
Redefinition of
nodeExists
bool nodeExists(
string
$id )
Returns whether the node with ID $id exists as tree node.
Parameters
| Name |
Type |
Description |
$id |
string |
|
Redefinition of
Last updated: Tue, 27 May 2008