Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe Nested
+ Graphe d'héritage de Nested:

Fonctions membres publiques

 debug ($level)
 
 getPath ($pk=null, $diagnostic=false)
 
 getTree ($pk=null, $diagnostic=false)
 
 isLeaf ($pk=null)
 
 setLocation ($referenceId, $position='after')
 
 move ($delta, $where='')
 
 moveByReference ($referenceId, $position='after', $pk=null, $recursiveUpdate=true)
 
 check ()
 
 store ($updateNulls=false)
 
 publish ($pks=null, $state=1, $userId=0)
 
 orderUp ($pk)
 
 orderDown ($pk)
 
 getRootId ()
 
 rebuild ($parentId=null, $leftId=0, $level=0, $path='')
 
 rebuildPath ($pk=null)
 
 reset ()
 
 saveorder ($idArray=null, $lftArray=null)
 
- Fonctions membres publiques hérités de Table
 __construct ($table, $key, DatabaseDriver $db, DispatcherInterface $dispatcher=null)
 
 getFields ($reload=false)
 
 appendPrimaryKeys ($query, $pk=null)
 
 getTableName ()
 
 getKeyName ($multiple=false)
 
 getId ()
 
 getDbo ()
 
 setDbo (DatabaseDriver $db)
 
 setRules ($input)
 
 getRules ()
 
 reset ()
 
 bind ($src, $ignore=array())
 
 load ($keys=null, $reset=true)
 
 check ()
 
 save ($src, $orderingFilter='', $ignore='')
 
 checkOut ($userId, $pk=null)
 
 checkIn ($pk=null)
 
 hasPrimaryKey ()
 
 hit ($pk=null)
 
 isCheckedOut ($with=0, $against=null)
 
 getNextOrder ($where='')
 
 getPrimaryKey (array $keys=array())
 
 reorder ($where='')
 
 move ($delta, $where='')
 
 publish ($pks=null, $state=1, $userId=0)
 
 getColumnAlias ($column)
 
 setColumnAlias ($column, $columnAlias)
 
 hasField ($key)
 
- Fonctions membres publiques hérités de CMSObject
 __construct ($properties=null)
 
 __toString ()
 
 def ($property, $default=null)
 
 get ($property, $default=null)
 
 getProperties ($public=true)
 
 getError ($i=null, $toString=true)
 
 getErrors ()
 
 set ($property, $value=null)
 
 setProperties ($properties)
 
 setError ($error)
 
- Fonctions membres publiques hérités de TableInterface
 delete ($pk=null)
 
 getKeyName ()
 
- Fonctions membres publiques hérités de DispatcherAwareInterface
 setDispatcher (DispatcherInterface $dispatcher)
 

Champs de données

 $parent_id
 
 $level
 
 $lft
 
 $rgt
 
 $alias
 
- Champs de données hérités de Table
 $typeAlias = null
 

Fonctions membres protégées

 recursiveUpdatePublishedColumn ($pk, $newState=null)
 
 _getNode ($id, $key=null)
 
 _getTreeRepositionData ($referenceNode, $nodeWidth, $position='before')
 
 _logtable ($showData=true, $showQuery=true)
 
 _runQuery ($query, $errorMessage)
 
- Fonctions membres protégées hérités de Table
 _getAssetName ()
 
 _getAssetTitle ()
 
 _lock ()
 
 _unlock ()
 

Attributs protégés

 $_location
 
 $_location_id
 
 $_cache = array()
 
 $_debug = 0
 
- Attributs protégés hérités de Table
 $_tbl = ''
 
 $_tbl_key = ''
 
 $_tbl_keys = array()
 
 $_db
 
 $_trackAssets = false
 
 $_rules
 
 $_locked = false
 
 $_autoincrement = true
 
 $_columnAlias = array()
 
 $_jsonEncode = array()
 
 $_supportNullValue = false
 
- Attributs protégés hérités de CMSObject
 $_errors = array()
 

Attributs protégés statiques

static $root_id = 0
 

Attributs privés

 $_validLocations = array('before', 'after', 'first-child', 'last-child')
 

Membres hérités additionnels

- Fonctions membres publiques statiques hérités de Table
static getInstance ($type, $prefix='JTable', $config=array())
 
static addIncludePath ($path=null)
 

Description détaillée

Table class supporting modified pre-order tree traversal behavior.

Depuis
1.7.0

Documentation des fonctions membres

◆ _getNode()

_getNode (   $id,
  $key = null 
)
protected

Method to get nested set properties for a node in the tree.

Paramètres
integer$idValue to look up the node by.
string$keyAn optional key to look up the node by (parent | left | right). If omitted, the primary key of the table is used.
Renvoie
mixed Boolean false on failure or node object on success.
Depuis
1.7.0
Exceptions

Références $id, $key, $query, et $this.

◆ _getTreeRepositionData()

_getTreeRepositionData (   $referenceNode,
  $nodeWidth,
  $position = 'before' 
)
protected

Method to get various data necessary to make room in the tree at a location for a node and its children. The returned data object includes conditions for SQL WHERE clauses for updating left and right id values to make room for the node as well as the new left and right ids for the node.

Paramètres
object$referenceNodeA node object with at least a 'lft' and 'rgt' with which to make room in the tree around for a new node.
integer$nodeWidthThe width of the node for which to make room in the tree.
string$positionThe position relative to the reference node where the room should be made.
Renvoie
mixed Boolean false on failure or data object on success.
Depuis
1.7.0

Références $data, et $position.

◆ _logtable()

_logtable (   $showData = true,
  $showQuery = true 
)
protected

Method to create a log table in the buffer optionally showing the query and/or data.

Paramètres
boolean$showDataTrue to show data
boolean$showQueryTrue to show query
Renvoie
void
Depuis
1.7.0

Références $buffer, $query, $rows, et ENT_QUOTES.

◆ _runQuery()

_runQuery (   $query,
  $errorMessage 
)
protected

Runs a query and unlocks the database on an error.

Paramètres
mixed$queryA string or DatabaseQuery object.
string$errorMessageUnused.
Renvoie
void
Note
Since 3.0.0 this method returns void and will rethrow the database exception.
Depuis
1.7.0
Exceptions

Références $query.

◆ check()

check ( )

Checks that the object is valid and able to be stored.

This method checks that the parent_id is non-zero and exists in the database. Note that the root node (parent_id = 0) cannot be manipulated with this class.

Renvoie
boolean True if all checks pass.
Depuis
1.7.0

Implémente TableInterface.

Références $query, et $this.

◆ debug()

debug (   $level)

Sets the debug level on or off

Paramètres
integer$level0 = off, 1 = on
Renvoie
void
Depuis
1.7.0

◆ getPath()

getPath (   $pk = null,
  $diagnostic = false 
)

Method to get an array of nodes from a given node to its root.

Paramètres
integer$pkPrimary key of the node for which to get the path.
boolean$diagnosticOnly select diagnostic data for the nested sets.
Renvoie
mixed An array of node objects including the start node.
Depuis
1.7.0
Exceptions

Références $query.

◆ getRootId()

getRootId ( )

Gets the ID of the root item in the tree

Renvoie
mixed The primary id of the root row, or false if not found and the internal error is set.
Depuis
1.7.0

Références $fields, $query, $result, et $this.

◆ getTree()

getTree (   $pk = null,
  $diagnostic = false 
)

Method to get a node and all its child nodes.

Paramètres
integer$pkPrimary key of the node for which to get the tree.
boolean$diagnosticOnly select diagnostic data for the nested sets.
Renvoie
mixed Boolean false on failure or array of node objects on success.
Depuis
1.7.0
Exceptions

Références $query.

◆ isLeaf()

isLeaf (   $pk = null)

Method to determine if a node is a leaf node in the tree (has no children).

Paramètres
integer$pkPrimary key of the node to check.
Renvoie
boolean True if a leaf node, false if not or null if the node does not exist.
Note
Since 3.0.0 this method returns null if the node does not exist.
Depuis
1.7.0
Exceptions

◆ move()

move (   $delta,
  $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.

Paramètres
integer$deltaThe direction and magnitude to move the row in the ordering sequence.
string$whereWHERE clause to use for limiting the selection of rows to compact the ordering values.
Renvoie
mixed Boolean true on success.
Depuis
1.7.0

Références $position, et $query.

◆ moveByReference()

moveByReference (   $referenceId,
  $position = 'after',
  $pk = null,
  $recursiveUpdate = true 
)

Method to move a node and its children to a new location in the tree.

Paramètres
integer$referenceIdThe primary key of the node to reference new location by.
string$positionLocation type string. ['before', 'after', 'first-child', 'last-child']
integer$pkThe primary key of the node to move.
boolean$recursiveUpdateFlag indicate that method recursiveUpdatePublishedColumn should be call.
Renvoie
boolean True on success.
Depuis
1.7.0
Exceptions

Références $fields, Joomla\Database\Query\$offset, $position, $query, $this, level, et null.

◆ orderDown()

orderDown (   $pk)

Method to move a node one position to the right in the same level.

Paramètres
integer$pkPrimary key of the node to move.
Renvoie
boolean True on success.
Depuis
1.7.0
Exceptions

Références $query.

◆ orderUp()

orderUp (   $pk)

Method to move a node one position to the left in the same level.

Paramètres
integer$pkPrimary key of the node to move.
Renvoie
boolean True on success.
Depuis
1.7.0
Exceptions

Références $query.

◆ publish()

publish (   $pks = null,
  $state = 1,
  $userId = 0 
)

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.

Paramètres
mixed$pksAn optional array of primary key values to update. If not set the instance property value is used.
integer$stateThe publishing state. eg. [0 = unpublished, 1 = published]
integer$userIdThe user id of the user performing the operation.
Renvoie
boolean True on success.
Depuis
1.7.0
Exceptions

Références $key, $published, $query, $state, $this, $userId, et ArrayHelper\toInteger().

◆ rebuild()

rebuild (   $parentId = null,
  $leftId = 0,
  $level = 0,
  $path = '' 
)

Method to recursively rebuild the whole nested set tree.

Paramètres
integer$parentIdThe root of the tree to rebuild.
integer$leftIdThe left id to start with in building the tree.
integer$levelThe level to assign to the current nodes.
string$pathThe path to the current nodes.
Renvoie
integer 1 + value of root rgt on success, false on failure
Depuis
1.7.0
Exceptions

Références $path, $query, $this, et null.

◆ rebuildPath()

rebuildPath (   $pk = null)

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.

Paramètres
integer$pkPrimary key of the node for which to get the path.
Renvoie
boolean True on success.
Depuis
1.7.0

Références $fields, $path, $query, et path.

◆ recursiveUpdatePublishedColumn()

recursiveUpdatePublishedColumn (   $pk,
  $newState = null 
)
protected

Method to recursive update published column for children rows.

Paramètres
integer$pkId number of row which published column was changed.
integer$newStateAn optional value for published column of row identified by $pk.
Renvoie
boolean True on success.
Depuis
3.7.0
Exceptions

We have to calculate the correct value for c2.published based on p2.published and own c2.published column, where (p2) is parent category is and (c2) current category

p2.published <= c2.published AND p2.published > 0 THEN c2.published 2 <= 2 THEN 2 (If archived in archived then archived) 1 <= 2 THEN 2 (If archived in published then archived) 1 <= 1 THEN 1 (If published in published then published)

p2.published > c2.published AND c2.published > 0 THEN p2.published 2 > 1 THEN 2 (If published in archived then archived)

p2.published > c2.published THEN c2.published ELSE p2.published 2 > -2 THEN -2 (If trashed in archived then trashed) 2 > 0 THEN 0 (If unpublished in archived then unpublished) 1 > 0 THEN 0 (If unpublished in published then unpublished) 0 > -2 THEN -2 (If trashed in unpublished then trashed) ELSE 0 <= 2 THEN 0 (If archived in unpublished then unpublished) 0 <= 1 THEN 0 (If published in unpublished then unpublished) 0 <= 0 THEN 0 (If unpublished in unpublished then unpublished) -2 <= -2 THEN -2 (If trashed in trashed then trashed) -2 <= 0 THEN -2 (If unpublished in trashed then trashed) -2 <= 1 THEN -2 (If published in trashed then trashed) -2 <= 2 THEN -2 (If archived in trashed then trashed)

Références $key, $published, $query, et null.

◆ reset()

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).

Renvoie
void
Depuis
3.2.1

Implémente TableInterface.

◆ saveorder()

saveorder (   $idArray = null,
  $lftArray = null 
)

Method to update order of table rows

Paramètres
array$idArrayid numbers of rows to be reordered.
array$lftArraylft values of rows to be reordered.
Renvoie
integer|boolean 1 + value of root rgt on success, false on failure.
Depuis
1.7.0
Exceptions

Références $count, $i, et $query.

◆ setLocation()

setLocation (   $referenceId,
  $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.

Paramètres
integer$referenceIdThe primary key of the node to reference new location by.
string$positionLocation type string.
Renvoie
void
Note
Since 3.0.0 this method returns void and throws an when an invalid position is passed.
Voir également
Nested::$_validLocations
Depuis
1.7.0
Exceptions

Références $position.

◆ store()

store (   $updateNulls = false)

Method to store a node in the database table.

Paramètres
boolean$updateNullsTrue to update null values as well.
Renvoie
boolean True on success.
Depuis
1.7.0

If we have a given primary key then we assume we are simply updating this node in the tree. We should assess whether or not we are moving the node or just updating its data fields.

Implémente TableInterface.

Références $query, $result, $this, AbstractEvent\create(), Joomla\CMS\Application\getDispatcher(), level, et Joomla\Event\setDispatcher().

Documentation des champs

◆ $_cache

$_cache = array()
protected

◆ $_debug

$_debug = 0
protected

◆ $_location

$_location
protected

◆ $_location_id

$_location_id
protected

◆ $_validLocations

$_validLocations = array('before', 'after', 'first-child', 'last-child')
private

◆ $alias

$alias

◆ $level

◆ $lft

$lft

◆ $parent_id

$parent_id

◆ $rgt

$rgt

◆ $root_id

$root_id = 0
staticprotected

La documentation de cette classe a été générée à partir du fichier suivant :