Nested
class Nested extends Table
Table class supporting modified pre-order tree traversal behavior.
Properties
Methods
Object constructor to set table and key fields. In most cases this will be overridden by child classes to explicitly set the table and key fields for a particular database table.
Implement \JObservableInterface: Adds an observer to this instance.
Gets the instance of the observer of class $observerClass
Static method to get an instance of a Table class if it can be found in the table include paths.
Add a filesystem path where Table should search for table class files.
Method to append the primary keys for this table to a query.
Method to get the primary key field name for the table.
Method to reset class properties to the defaults set in the class definition. It will ignore the primary key as well as any private class properties (except $_errors).
Method to bind an associative array or object to the Table instance.This method only binds properties that are publicly accessible and optionally takes an array of properties to ignore when binding.
Method to load a row from the database by primary key and bind the fields to the Table instance properties.
Checks that the object is valid and able to be stored.
Method to store a node in the database table.
Method to provide a shortcut to binding, checking and storing a Table instance to the database table.
Method to delete a node and, optionally, its child nodes from the table.
Method to check a row out if the necessary properties/fields exist.
Method to check a row in if the necessary properties/fields exist.
Method to increment the hits for a row if the necessary property/field exists.
Method to determine if a row is checked out and therefore uneditable by a user.
Method to get the next ordering value for a group of rows defined by an SQL WHERE clause.
Get the primary key values for this table using passed in values as a default.
Method to compact the ordering values of rows in a group of rows defined by an SQL WHERE clause.
Method to move a row in the ordering sequence of a group of rows defined by an SQL WHERE clause.
Method to set the publishing state for a node or list of nodes in the database table. The method respects rows checked out by other users and will attempt to checkin rows that it can after adjustments are made. The method will not allow you to set a publishing state higher than any ancestor node and will not allow you to set a publishing state on a node with a checked out child.
Method to return the real name of a "special" column such as ordering, hits, published etc etc. In this way you are free to follow your db naming convention and use the built in \Joomla functions.
Method to register a column alias for a "special" column.
Sets the debug level on or off
Method to get an array of nodes from a given node to its root.
Method to get a node and all its child nodes.
Method to determine if a node is a leaf node in the tree (has no children).
Method to set the location of a node in the tree object. This method does not save the new location to the database, but will set it in the object so that when the node is stored it will be stored in the new location.
Method to move a node and its children to a new location in the tree.
Method to move a node one position to the left in the same level.
Method to move a node one position to the right in the same level.
Gets the ID of the root item in the tree
Method to recursively rebuild the whole nested set tree.
Method to rebuild the node's path field from the alias values of the nodes from the current node to the root node of the tree.
Method to update order of table rows
Details
__construct(
string $table,
mixed $key,
JDatabaseDriver $db)
Object constructor to set table and key fields. In most cases this will be overridden by child classes to explicitly set the table and key fields for a particular database table.
void
attachObserver(
JObserverInterface $observer)
Implement \JObservableInterface: Adds an observer to this instance.
This method will be called fron the constructor of classes implementing \JObserverInterface which is instanciated by the constructor of $this with \JObserverMapper::attachAllObservers($this)
JTableObserver|null
getObserverOfClass(
string $observerClass)
Gets the instance of the observer of class $observerClass
static
Table|boolean
getInstance(
string $type,
string $prefix = 'JTable',
array $config = array())
Static method to get an instance of a Table class if it can be found in the table include paths.
To add include paths for searching for Table classes see Table::addIncludePath().
static
array
addIncludePath(
array|string $path = null)
Add a filesystem path where Table should search for table class files.
void
appendPrimaryKeys(
JDatabaseQuery $query,
mixed $pk = null)
Method to append the primary keys for this table to a query.
mixed
getKeyName(
boolean $multiple = false)
Method to get the primary key field name for the table.
void
reset()
Method to reset class properties to the defaults set in the class definition. It will ignore the primary key as well as any private class properties (except $_errors).
boolean
bind(
array|object $src,
array|string $ignore = array())
Method to bind an associative array or object to the Table instance.This method only binds properties that are publicly accessible and optionally takes an array of properties to ignore when binding.
boolean
load(
mixed $keys = null,
boolean $reset = true)
Method to load a row from the database by primary key and bind the fields to the Table instance properties.
boolean
check()
Checks that the object is valid and able to be stored.
This method checks that the parentid is non-zero and exists in the database. Note that the root node (parentid = 0) cannot be manipulated with this class.
boolean
save(
array|object $src,
string $orderingFilter = '',
array|string $ignore = '')
Method to provide a shortcut to binding, checking and storing a Table instance to the database table.
The method will check a row in once the data has been stored and if an ordering filter is present will attempt to reorder the table rows based on the filter. The ordering filter is an instance property name. The rows that will be reordered are those whose value matches the Table instance for the property specified.
boolean
delete(
mixed $pk = null,
boolean $children = true)
Method to delete a node and, optionally, its child nodes from the table.
boolean
checkOut(
integer $userId,
mixed $pk = null)
Method to check a row out if the necessary properties/fields exist.
To prevent race conditions while editing rows in a database, a row can be checked out if the fields 'checkedout' and 'checkedout_time' are available. While a row is checked out, any attempt to store the row by a user other than the one who checked the row out should be held until the row is checked in again.
boolean
checkIn(
mixed $pk = null)
Method to check a row in if the necessary properties/fields exist.
Checking a row in will allow other users the ability to edit the row.
boolean
hit(
mixed $pk = null)
Method to increment the hits for a row if the necessary property/field exists.
boolean
isCheckedOut(
integer $with,
integer $against = null)
Method to determine if a row is checked out and therefore uneditable by a user.
If the row is checked out by the same user, then it is considered not checked out -- as the user can still edit it.
integer
getNextOrder(
string $where = '')
Method to get the next ordering value for a group of rows defined by an SQL WHERE clause.
This is useful for placing a new item last in a group of items in the table.
array
getPrimaryKey(
array $keys = array())
Get the primary key values for this table using passed in values as a default.
mixed
reorder(
string $where = '')
Method to compact the ordering values of rows in a group of rows defined by an SQL WHERE clause.
boolean
move(
integer $delta,
string $where = '')
Method to move a row in the ordering sequence of a group of rows defined by an SQL WHERE clause.
Negative numbers move the row up in the sequence and positive numbers move it down.
boolean
publish(
mixed $pks = null,
integer $state = 1,
integer $userId)
Method to set the publishing state for a node or list of nodes in the database table. The method respects rows checked out by other users and will attempt to checkin rows that it can after adjustments are made. The method will not allow you to set a publishing state higher than any ancestor node and will not allow you to set a publishing state on a node with a checked out child.
string
getColumnAlias(
string $column)
Method to return the real name of a "special" column such as ordering, hits, published etc etc. In this way you are free to follow your db naming convention and use the built in \Joomla functions.
void
setColumnAlias(
string $column,
string $columnAlias)
Method to register a column alias for a "special" column.
mixed
getPath(
integer $pk = null,
boolean $diagnostic = false)
Method to get an array of nodes from a given node to its root.
mixed
getTree(
integer $pk = null,
boolean $diagnostic = false)
Method to get a node and all its child nodes.
boolean
isLeaf(
integer $pk = null)
Method to determine if a node is a leaf node in the tree (has no children).
void
setLocation(
integer $referenceId,
string $position = 'after')
Method to set the location of a node in the tree object. This method does not save the new location to the database, but will set it in the object so that when the node is stored it will be stored in the new location.
boolean
moveByReference(
integer $referenceId,
string $position = 'after',
integer $pk = null,
boolean $recursiveUpdate = true)
Method to move a node and its children to a new location in the tree.
integer
rebuild(
integer $parentId = null,
integer $leftId,
integer $level,
string $path = '')
Method to recursively rebuild the whole nested set tree.