$idColumnName
$idColumnName : integer
Nested Set class for build left, right, level data.
deletePullUpChildren(integer $taxonomy_id, array $where = array()) : boolean
Delete the selected taxonomy ID and pull children's parent ID to the same as selected one.<br> Example: selected taxonomy ID is 4, its parent ID is 2. This method will be pull all children that has parent ID = 4 to 2 and delete the taxonomy ID 4.<br> Always run <code>$NestedSet->rebuild()</code> after insert, update, delete to rebuild the correctly level, left, right data.
integer | $taxonomy_id | The selected taxonomy ID. |
array | $where | Where array structure will be like this. array( 'whereString' => '(`columnName` = :value1 AND `columnName2` = :value2)', 'whereValues' => array(':value1' => 'lookup value 1', ':value2' => 'lookup value2'), ) |
Return true on success, false for otherwise.
deleteWithChildren(integer $taxonomy_id, array $where = array()) : mixed
Delete the selected taxonomy ID with its ALL children.<br> Always run <code>$NestedSet->rebuild()</code> after insert, update, delete to rebuild the correctly level, left, right data.
The columns left
, right
must have been built before using this method, otherwise the result will be incorrect.
integer | $taxonomy_id | The taxonomy ID to delete. |
array | $where | Where array structure will be like this. array( 'whereString' => '(`parent`.`columnName` = :value1 AND `parent`.`columnName2` = :value2)', 'whereValues' => array(':value1' => 'lookup value 1', ':value2' => 'lookup value2'), ) |
Return number on success, return false for otherwise.
getNewPosition(integer $parent_id, array $where = array()) : integer
Get new position for taxonomy in the selected parent.
integer | $parent_id | The parent ID. If root, set this to 0. |
array | $where | Where array structure will be like this. array( 'whereString' => '(`columnName` = :value1 AND `columnName2` = :value2)', 'whereValues' => array(':value1' => 'lookup value 1', ':value2' => 'lookup value2'), ) |
Return the new position in the same parent.
WARNING! If there are no results or the results according to the conditions cannot be found. It always returns 1.
getTaxonomyWithChildren(array $options = array()) : mixed
Get taxonomy from selected item and fetch its ALL children.<br> Example: There are taxonomy tree like this. Root 1 > 1.1 > 1.1.1, Root 2, Root 3 > 3.1, Root 3 > 3.2 > 3.2.1, Root 3 > 3.2 > 3.2.2, Root 3 > 3.3<br> Assume that selected item is Root 3. So, the result will be Root 3 > 3.1, 3.2 > 3.2.1, 3.2.2, 3.3<br>
Warning! Even this method has options for search, custom where conditions
but it is recommended that you should set the option to select only specific item.
This method is intended to show results from a single target.
The columns left
, right
must have been built before using this method, otherwise the result will be incorrect.
array | $options | Available options: |
Return array object of taxonomy data if found, return null
if not found.
getTaxonomyWithParents(array $options = array()) : mixed
Get taxonomy from selected item and fetch its parent in a line until root item.<br> Example: There are taxonomy tree like this. Root1 > 1.1 > 1.1.1 > 1.1.1.1<br> Assume that you selected at 1.1.1. So, the result will be Root1 > 1.1 > 1.1.1<br> But if you set 'skipCurrent' to true the result will be Root1 > 1.1
Warning! Even this method has options for search, custom where conditions
but it is recommended that you should set the option to select only specific item.
This method is intended to show results from a single target.
The columns left
, right
must have been built before using this method, otherwise the result will be incorrect.
array | $options | Available options: |
Return array object of taxonomy data if found, return null if not found.
isParentUnderMyChildren(integer $taxonomy_id, integer $parent_id, array $where = array()) : boolean
Detect that is this taxonomy's parent setting to be under this taxonomy's children or not.<br> For example: Root 1 > 1.1 > 1.1.1 > 1.1.1.1 > 1.1.1.1.1<br> Assume that you editing 1.1.1 and its parent is 1.1. Now you change its parent to 1.1.1.1.1 which is under its children.<br> The parent of 1.1.1 must be root, Root 1, 1.1 and never go under that.
integer | $taxonomy_id | The taxonomy ID that is chaging the parent. |
integer | $parent_id | The selected parent ID to check. |
array | $where | Where array structure will be like this. array( 'whereString' => '(`node`.`columnName` = :value1 AND `node`.`columnName2` = :value2)', 'whereValues' => array(':value1' => 'lookup value 1', ':value2' => 'lookup value2'), ) |
Return true
if its parent is under its children (INCORRECT changes).
Return true
if search result was not found (INCORRECT changes).
Return false
if its parent is not under its children (CORRECT changes).
listTaxonomy(array $options = array()) : array
List taxonomy.
The columns left
, right
must have been built before using this method, otherwise the result will be incorrect.
array | $options | Available options: |
Return array with 'total' and 'items' as keys.
listTaxonomyFlatten(array $options = array()) : array
List taxonomy as flatten not tree.<br> All parameters or arguments are same as `listTaxonomy()` method.
array | $options | Available options: |
Return array with 'total' and 'items' as keys.
rebuild(array $where = array())
Rebuilds the tree data and save it to the database.<br> This will be rebuild the level, left, right values.
The columns left
, right
must have been built before using this method, otherwise the result will be incorrect.
array | $where | Where array structure will be like this. array( 'whereString' => '(`columnName` = :value1 AND `columnName2` = :value2)', 'whereValues' => array(':value1' => 'lookup value 1', ':value2' => 'lookup value2'), ) |