Class JTableNested
	
	
Table class supporting modified pre-order tree traversal behavior.
	 
	
		- 
			JObject
			
			
			
		
- 
			 JTable
			
			 implements 
				JObservableInterface, 
			
				JTableInterface JTable
			
			 implements 
				JObservableInterface, 
			
				JTableInterface
- 
			 JTableNested JTableNested
Methods summary
		
		
			| 
				 public 
				
				
				 | 
			#
			debug( integer $level )
				
Sets the debug level on or off 
				
Sets the debug level on or off Parameters
						$levelinteger- $level 0 = off, 1 = onSince
							11.1
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getPath( integer $pk = null, boolean $diagnostic = false )
				
Method to get an array of nodes from a given node to its root. 
				
Method to get an array of nodes from a given node to its root. Parameters
						$pkinteger- $pk Primary key of the node for which to get the path.$diagnosticboolean- $diagnostic Only select diagnostic data for the nested sets.Returns
						mixed- An array of node objects including the start node.
 ThrowsSince
							11.1
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getTree( integer $pk = null, boolean $diagnostic = false )
				
Method to get a node and all its child nodes. 
				
Method to get a node and all its child nodes. Parameters
						$pkinteger- $pk Primary key of the node for which to get the tree.$diagnosticboolean- $diagnostic Only select diagnostic data for the nested sets.Returns
						mixed- Boolean false on failure or array of node objects on success.
 ThrowsSince
							11.1
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			isLeaf( integer $pk = null )
				
Method to determine if a node is a leaf node in the tree (has no
children). 
				
Method to determine if a node is a leaf node in the tree (has no
children). Parameters
						$pkinteger- $pk Primary key of the node to check.Returns
						boolean- True if a leaf node, false if not or null if the node does not exist.
 ThrowsSince
							11.1
 Note
							Since 12.1 this method returns null if the node does not exist.
 | 
		
			| 
				 public 
				
				
				 | 
			#
			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. 
				
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. Parameters
						$referenceIdinteger- $referenceId The primary key of the node to reference new location by.$positionstring- $position Location type string.ThrowsSince
							11.1
 See
							JTableNested::$_validLocations
 Note
							Since 12.1 this method returns void and throws an InvalidArgumentException when
an invalid position is passed.
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			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. 
				
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. Parameters
						$deltainteger- $delta The direction and magnitude to move the row in the ordering sequence.$wherestring- $where WHERE clause to use for limiting the selection of rows to compact the
ordering values.Returns
						mixed- Boolean true on success.
 ThrowsSince
							11.1
 Overrides | 
		
			| 
				 public 
				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. 
				
Method to move a node and its children to a new location in the tree. Parameters
						$referenceIdinteger- $referenceId The primary key of the node to reference new location by.$positionstring- $position Location type string. ['before', 'after', 'first-child', 'last-child']$pkinteger- $pk The primary key of the node to move.$recursiveUpdateboolean- $recursiveUpdate Flag indicate that method recursiveUpdatePublishedColumn should
be call.Returns
						boolean- True on success.
 ThrowsSince
							11.1
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			delete( integer $pk = null, boolean $children = true )
				
Method to delete a node and, optionally, its child nodes from the table. 
				
Method to delete a node and, optionally, its child nodes from the table. Parameters
						$pkinteger- $pk The primary key of the node to delete.$childrenboolean- $children True to delete child nodes, false to move them up a level.Returns
						boolean- True on success.
 ThrowsSince
							11.1
 Overrides | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			check( )
				
Checks that the object is valid and able to be stored. 
				
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. Returns
						boolean- True if all checks pass.
 Since
							11.1
 Overrides | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			store( boolean $updateNulls = false )
				
Method to store a node in the database table. 
				
Method to store a node in the database table. Parameters
						$updateNullsboolean- $updateNulls True to update null values as well.Returns
						boolean- True on success.
 Since
							11.1
 Overrides | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			publish( mixed $pks = null, integer $state = 1, integer $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. 
				
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. Parameters
						$pksmixed- $pks An optional array of primary key values to update. If not set the instance
property value is used.$stateinteger- $state The publishing state. eg. [0 = unpublished, 1 = published]$userIdinteger- $userId The user id of the user performing the operation.Returns
						boolean- True on success.
 ThrowsSince
							11.1
 Overrides | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			orderUp( integer $pk )
				
Method to move a node one position to the left in the same level. 
				
Method to move a node one position to the left in the same level. Parameters
						$pkinteger- $pk Primary key of the node to move.Returns
						boolean- True on success.
 ThrowsSince
							11.1
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			orderDown( integer $pk )
				
Method to move a node one position to the right in the same level. 
				
Method to move a node one position to the right in the same level. Parameters
						$pkinteger- $pk Primary key of the node to move.Returns
						boolean- True on success.
 ThrowsSince
							11.1
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getRootId( )
				
Gets the ID of the root item in the tree 
				
Gets the ID of the root item in the tree Returns
						mixed- The primary id of the root row, or false if not found and the internal error is
set.
 Since
							11.1
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			rebuild( integer $parentId = null, integer $leftId = 0, integer $level = 0, string $path = '' )
				
Method to recursively rebuild the whole nested set tree. 
				
Method to recursively rebuild the whole nested set tree. Parameters
						$parentIdinteger- $parentId The root of the tree to rebuild.$leftIdinteger- $leftId The left id to start with in building the tree.$levelinteger- $level The level to assign to the current nodes.$pathstring- $path The path to the current nodes.Returns
						integer- 1 + value of root rgt on success, false on failure
 ThrowsSince
							11.1
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			rebuildPath( integer $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. 
				
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. Parameters
						$pkinteger- $pk Primary key of the node for which to get the path.Returns
						boolean- True on success.
 Since
							11.1
 | 
		
			| 
				 public 
				
				
				 | 
			#
			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). 
				
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). Since
							3.2.1
 Overrides | 
		
			| 
				 public 
				integer
				
				 | 
			#
			saveorder( array $idArray = null, array $lft_array = null )
				
Method to update order of table rows 
				
Method to update order of table rows Parameters
						$idArrayarray- $idArray id numbers of rows to be reordered.$lft_arrayarray- $lft_array lft values of rows to be reordered.Returns
						integer- 1 + value of root rgt on success, false on failure.
 ThrowsSince
							11.1
 | 
		
			| 
				 protected 
				boolean
				
				 | 
			#
			recursiveUpdatePublishedColumn( integer $pk, integer $newState = null )
				
Method to recursive update published column for children rows. 
				
Method to recursive update published column for children rows. Parameters
						$pkinteger- $pk Id number of row which published column was changed.$newStateinteger- $newState An optional value for published column of row identified by $pk.Returns
						boolean- True on success.
 ThrowsSince
							3.7.0
 | 
		
			| 
				 protected 
				mixed
				
				 | 
			#
			_getNode( integer $id, string $key = null )
				
Method to get nested set properties for a node in the tree. 
				
Method to get nested set properties for a node in the tree. Parameters
						$idinteger- $id Value to look up the node by.$keystring- $key An optional key to look up the node by (parent | left | right). If omitted,
the primary key of the table is used.Returns
						mixed- Boolean false on failure or node object on success.
 ThrowsSince
							11.1
 | 
		
			| 
				 protected 
				mixed
				
				 | 
			#
			_getTreeRepositionData( object $referenceNode, integer $nodeWidth, string $position = 'before' )
				
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. 
				
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. Parameters
						$referenceNodeobject- $referenceNode A node object with at least a 'lft' and 'rgt' with which to make
room in the tree around for a new node.$nodeWidthinteger- $nodeWidth The width of the node for which to make room in the tree.$positionstring- $position The position relative to the reference node where the room should be
made.Returns
						mixed- Boolean false on failure or data object on success.
 Since
							11.1
 | 
		
			| 
				 protected 
				
				
				 | 
			#
			_logtable( boolean $showData = true, boolean $showQuery = true )
				
Method to create a log table in the buffer optionally showing the query
and/or data. 
				
Method to create a log table in the buffer optionally showing the query
and/or data. Parameters
						$showDataboolean- $showData True to show data$showQueryboolean- $showQuery True to show querySince
							11.1
 CodeCoverageIgnore
					 | 
		
			| 
				 protected 
				boolean
				
				 | 
			#
			_runQuery( mixed $query, string $errorMessage )
				
Runs a query and unlocks the database on an error. 
				
Runs a query and unlocks the database on an error. Parameters
						$querymixed- $query A string or JDatabaseQuery object.$errorMessagestring- $errorMessage Unused.Returns
						boolean- void
 ThrowsSince
							11.1
 Note
							Since 12.1 this method returns void and will rethrow the database exception.
 | 
		
		Methods inherited from JTable
		
			__construct(), 
			_getAssetName(), 
			_getAssetParentId(), 
			_getAssetTitle(), 
			_lock(), 
			_unlock(), 
			addIncludePath(), 
			appendPrimaryKeys(), 
			attachObserver(), 
			bind(), 
			checkIn(), 
			checkOut(), 
			getColumnAlias(), 
			getDbo(), 
			getFields(), 
			getInstance(), 
			getKeyName(), 
			getNextOrder(), 
			getObserverOfClass(), 
			getPrimaryKey(), 
			getRules(), 
			getTableName(), 
			hasPrimaryKey(), 
			hit(), 
			isCheckedOut(), 
			load(), 
			reorder(), 
			save(), 
			setColumnAlias(), 
			setDbo(), 
			setRules()
		
		Methods inherited from JObject
		
			__toString(), 
			def(), 
			get(), 
			getError(), 
			getErrors(), 
			getProperties(), 
			set(), 
			setError(), 
			setProperties()
		
		Magic methods summary
		Properties summary
		
		
			| 
				public  
				integer
			 | $parent_id | 
				#
				
					
Object property holding the primary key of the parent node. Provides
adjacency list data for nodes. 
					
Object property holding the primary key of the parent node. Provides
adjacency list data for nodes. Since
								11.1
 | 
		
			| 
				public  
				integer
			 | $level | 
				#
				
					
Object property holding the depth level of the node in the tree. 
					
Object property holding the depth level of the node in the tree. Since
								11.1
 | 
		
			| 
				public  
				integer
			 | $lft | 
				#
				
					
Object property holding the left value of the node for managing its placement
in the nested sets tree. 
					
Object property holding the left value of the node for managing its placement
in the nested sets tree. Since
								11.1
 | 
		
			| 
				public  
				integer
			 | $rgt | 
				#
				
					
Object property holding the right value of the node for managing its
placement in the nested sets tree. 
					
Object property holding the right value of the node for managing its
placement in the nested sets tree. Since
								11.1
 | 
		
			| 
				public  
				string
			 | $alias | 
				#
				
					
Object property holding the alias of this node used to constuct the full text
path, forward-slash delimited. 
					
Object property holding the alias of this node used to constuct the full text
path, forward-slash delimited. Since
								11.1
 | 
		
			| 
				protected  
				string
			 | $_location | 
				#
				
					
Object property to hold the location type to use when storing the row. 
					
Object property to hold the location type to use when storing the row. Since
								11.1
 See
								JTableNested::$_validLocations
 | 
		
			| 
				protected  
				integer
			 | $_location_id | 
				#
				
					
Object property to hold the primary key of the location reference node to use
when storing the row. 
					
Object property to hold the primary key of the location reference node to use
when storing the row. A combination of location type and reference node describes where to store
the current node in the tree. Since
								11.1
 | 
		
			| 
				protected  
				array
			 | $_cache | 
				#
				
					
An array to cache values in recursive processes. 
					
An array to cache values in recursive processes. Since
								11.1
 | 
		
			| 
				protected  
				integer
			 | $_debug |  | 
		
			| 
				protected static 
				integer
			 | $root_id | 
				#
				
				
					
Cache for the root ID Since
								3.3
 | 
		
		Properties inherited from JTable
		
			$_autoincrement, 
			$_columnAlias, 
			$_db, 
			$_jsonEncode, 
			$_locked, 
			$_observers, 
			$_rules, 
			$_tbl, 
			$_tbl_key, 
			$_tbl_keys, 
			$_trackAssets
		
		Properties inherited from JObject
		
			$_errors