Documentation

NestedSet
in package

Table of Contents

Properties

$ERRORS  : array<string|int, mixed>
Ошибки
$ERRORS_MES  : array<string|int, mixed>
Сообщения об ошибках
$_table  : string
Таблица
$_table_id  : string
Поле ID
$_table_left  : string
Левый индекс
$_table_level  : string
ПОле уровень
$_table_parent  : string
Поле parent
$_table_right  : string
Правый индекс
$dataPoint  : DataAccessPoint
Точка доступа

Methods

__construct()  : mixed
Конструктор
__get()  : mixed
Геттер
Ajar()  : IDataReader|null
Returns a slightly opened tree from an element with number $id.
Branch()  : IDataReader|null
Returns all elements of a branch starting from an element with number $id.
ChangePosition()  : bool
Change items position.
ChangePositionAll()  : bool
Swapping nodes within the same level and limits of one parent with all its children: $id1 placed before or after $id2.
Clear()  : bool
Очищает данные
CountAll()  : bool
Counts element with number $id from the tree and all it childret.
Delete()  : bool
Delete element with number $id from the tree wihtout deleting it's children.
DeleteAll()  : bool
Delete element with number $id from the tree and all it childret.
Full()  : IDataReader|null
Returns all elements of the tree sortet by left.
GetNode()  : mixed
Возвращает данные по ноде
GetParentInfo()  : stdClass|null
Receives parent left, right and level for unit with number $id.
GetPositionNumber()  : int
Gets a position number
GetRootNode()  : mixed
Возвращает данные корневой ноды
Insert()  : int|null
Add a new element in the tree to element with number $section_id.
InsertNear()  : int|null
Add a new element in the tree near element with number id.
MoveAll()  : bool
Assigns a node with all its children to another parent.
Parents()  : IDataReader|null
Returns all parents of element with number $id.
Update()  : QueryInfo|null
Обновляет данные
_PrepareCondition()  : string
Transform array with conditions to SQL query Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = \'www\'', 'sec2 <> \'erere\'')), etc where array key - condition (AND, OR, etc), value - condition string.
_PrepareJoin()  : string
Transform array with conditions to SQL query Array structure: array $joinWith Array structure: array('outer' => array('table' => array('fieldfrom', 'fieldto')), 'inner' => array('table' => array('fieldfrom', 'fieldto')), etc where array key - join type (inner, outer, cross), condition - condition string where array key - condition (AND, OR, etc), value - condition string.
_setError()  : void
Ошибка
GetNodeInfo()  : array<string|int, mixed>|null
Receives left, right and level for unit with number id.

Properties

$ERRORS

Ошибки

public array<string|int, mixed> $ERRORS = array()

$ERRORS_MES

Сообщения об ошибках

public array<string|int, mixed> $ERRORS_MES = array()

$_table

Таблица

private string $_table

$_table_id

Поле ID

private string $_table_id

$_table_left

Левый индекс

private string $_table_left

$_table_level

ПОле уровень

private string $_table_level

$_table_parent

Поле parent

private string $_table_parent

$_table_right

Правый индекс

private string $_table_right

Methods

__construct()

Конструктор

public __construct(DataAccessPoint $dtp, string $table, string $id, string $left, string $right, string $level, string $parent) : mixed
Parameters
$dtp : DataAccessPoint
$table : string
$id : string
$left : string
$right : string
$level : string
$parent : string

__get()

Геттер

public __get(string $property) : mixed
Parameters
$property : string

Ajar()

Returns a slightly opened tree from an element with number $id.

public Ajar(int $id[, array<string|int, mixed> $fields = '' ][, array<string|int, mixed> $condition = '' ][, int $page = -1 ][, int $pagesize = 10 ]) : IDataReader|null
Parameters
$id : int

Node unique id

$fields : array<string|int, mixed> = ''

needed fields (if is): array('filed1 name', 'filed2 name', etc)

$condition : array<string|int, mixed> = ''

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = 'www'', 'sec2 <> 'erere'')), etc where array key - condition (AND, OR, etc), value - condition string

$page : int = -1

Page

$pagesize : int = 10

Pagesize

Return values
IDataReader|null

Branch()

Returns all elements of a branch starting from an element with number $id.

public Branch(int $id[, array<string|int, mixed> $fields = '' ][, array<string|int, mixed> $condition = '' ][, array<string|int, mixed> $joinWith = '' ][, int $page = -1 ][, int $pagesize = 10 ]) : IDataReader|null
Parameters
$id : int

Node unique id

$fields : array<string|int, mixed> = ''

needed fields (if is): array('filed1 name', 'filed2 name', etc)

$condition : array<string|int, mixed> = ''

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = 'www'', 'sec2 <> 'erere'')), etc where array key - condition (AND, OR, etc), value - condition string

$joinWith : array<string|int, mixed> = ''

Array structure: array('outer' => array('table' => 'condition'), 'inner' => array('table', 'condition')), etc where array key - join type (inner, outer, cross), condition - condition string

$page : int = -1

Page

$pagesize : int = 10

Pagesize

Return values
IDataReader|null

ChangePosition()

Change items position.

public ChangePosition(int $id1, int $id2) : bool
Parameters
$id1 : int

first item ID

$id2 : int

second item ID

Return values
bool

TRUE if successful, FALSE otherwise.

ChangePositionAll()

Swapping nodes within the same level and limits of one parent with all its children: $id1 placed before or after $id2.

public ChangePositionAll(int $id1, int $id2[, string $position = 'after' ][, array<string|int, mixed> $condition = '' ]) : bool
Parameters
$id1 : int

first item ID

$id2 : int

second item ID

$position : string = 'after'

'before' or 'after' $id2

$condition : array<string|int, mixed> = ''

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = 'www'', 'sec2 <> 'erere'')), etc where array key - condition (AND, OR, etc), value - condition string

Return values
bool

TRUE if successful, FALSE otherwise.

Clear()

Очищает данные

public Clear([array<string|int, mixed> $data = array() ]) : bool
Parameters
$data : array<string|int, mixed> = array()
Return values
bool

CountAll()

Counts element with number $id from the tree and all it childret.

public CountAll(int $id[, array<string|int, mixed> $condition = '' ]) : bool
Parameters
$id : int

Number of element

$condition : array<string|int, mixed> = ''

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = 'www'', 'sec2 <> 'erere'')), etc where array key - condition (AND, OR, etc), value - condition string

Return values
bool

TRUE if successful, FALSE otherwise.

Delete()

Delete element with number $id from the tree wihtout deleting it's children.

public Delete(int $id[, array<string|int, mixed> $condition = '' ]) : bool
Parameters
$id : int

Number of element

$condition : array<string|int, mixed> = ''

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = 'www'', 'sec2 <> 'erere'')), etc where array key - condition (AND, OR, etc), value - condition string

Return values
bool

TRUE if successful, FALSE otherwise.

DeleteAll()

Delete element with number $id from the tree and all it childret.

public DeleteAll(int $id[, array<string|int, mixed> $condition = '' ]) : bool
Parameters
$id : int

Number of element

$condition : array<string|int, mixed> = ''

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = 'www'', 'sec2 <> 'erere'')), etc where array key - condition (AND, OR, etc), value - condition string

Return values
bool

TRUE if successful, FALSE otherwise.

Full()

Returns all elements of the tree sortet by left.

public Full(array<string|int, mixed> $fields[, array<string|int, mixed> $condition = '' ][, string $joinWith = '' ][, int $page = -1 ][, int $pagesize = 10 ]) : IDataReader|null
Parameters
$fields : array<string|int, mixed>

needed fields (if is): array('filed1 name', 'filed2 name', etc)

$condition : array<string|int, mixed> = ''

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = 'www'', 'sec2 <> 'erere'')), etc where array key - condition (AND, OR, etc), value - condition string

$joinWith : string = ''

Join string

$page : int = -1

Page

$pagesize : int = 10

Pagesize

Return values
IDataReader|null

needed fields

GetNode()

Возвращает данные по ноде

public GetNode([bool $section_id = false ][, bool $returnAsReader = false ][, string $criteria = '' ]) : mixed
Parameters
$section_id : bool = false
$returnAsReader : bool = false
$criteria : string = ''

GetParentInfo()

Receives parent left, right and level for unit with number $id.

public GetParentInfo(int $section_id[, array<string|int, mixed> $condition = '' ]) : stdClass|null
Parameters
$section_id : int
$condition : array<string|int, mixed> = ''

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = 'www'', 'sec2 <> 'erere'')), etc where array key - condition (AND, OR, etc), value - condition string

Return values
stdClass|null

GetPositionNumber()

Gets a position number

public GetPositionNumber(int $id[, string $condition = '' ]) : int
Parameters
$id : int
$condition : string = ''
Return values
int

GetRootNode()

Возвращает данные корневой ноды

public GetRootNode([bool $returnAsReader = false ]) : mixed
Parameters
$returnAsReader : bool = false

Insert()

Add a new element in the tree to element with number $section_id.

public Insert(int $section_id[, array<string|int, mixed> $data = array() ]) : int|null
Parameters
$section_id : int

Number of a parental element

$data : array<string|int, mixed> = array()

Contains parameters for additional fields of a tree (if is): array('filed name' => 'importance', etc)

Return values
int|null

Inserted element id

InsertNear()

Add a new element in the tree near element with number id.

public InsertNear(int $id[, array<string|int, mixed> $condition = '' ][, array<string|int, mixed> $data = array() ]) : int|null
Parameters
$id : int

Number of a parental element

$condition : array<string|int, mixed> = ''

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = 'www'', 'sec2 <> 'erere'')), etc where array key - condition (AND, OR, etc), value - condition string

$data : array<string|int, mixed> = array()

Contains parameters for additional fields of a tree (if is): array('filed name' => 'importance', etc)

Return values
int|null

Inserted element id

MoveAll()

Assigns a node with all its children to another parent.

public MoveAll(int $id, int $newParentId) : bool
Parameters
$id : int

node ID

$newParentId : int

ID of new parent node

Return values
bool

TRUE if successful, FALSE otherwise.

Parents()

Returns all parents of element with number $id.

public Parents(int $id[, array<string|int, mixed> $fields = '' ][, array<string|int, mixed> $condition = '' ][, string $joinWith = '' ]) : IDataReader|null
Parameters
$id : int

Node unique id

$fields : array<string|int, mixed> = ''

needed fields (if is): array('filed1 name', 'filed2 name', etc)

$condition : array<string|int, mixed> = ''

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = 'www'', 'sec2 <> 'erere'')), etc where array key - condition (AND, OR, etc), value - condition string

$joinWith : string = ''

Join string

Return values
IDataReader|null

Update()

Обновляет данные

public Update(int $id, array<string|int, mixed> $data) : QueryInfo|null
Parameters
$id : int
$data : array<string|int, mixed>
Return values
QueryInfo|null

_PrepareCondition()

Transform array with conditions to SQL query Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = \'www\'', 'sec2 <> \'erere\'')), etc where array key - condition (AND, OR, etc), value - condition string.

private _PrepareCondition(array<string|int, mixed>|string $condition[, bool $where = false ][, string $prefix = '' ]) : string
Parameters
$condition : array<string|int, mixed>|string
$where : bool = false
  • True - yes, flase - not
$prefix : string = ''
Return values
string

_PrepareJoin()

Transform array with conditions to SQL query Array structure: array $joinWith Array structure: array('outer' => array('table' => array('fieldfrom', 'fieldto')), 'inner' => array('table' => array('fieldfrom', 'fieldto')), etc where array key - join type (inner, outer, cross), condition - condition string where array key - condition (AND, OR, etc), value - condition string.

private _PrepareJoin(array<string|int, mixed>|string $joinWith[, string $prefix = '' ]) : string
Parameters
$joinWith : array<string|int, mixed>|string
$prefix : string = ''
Return values
string

_setError()

Ошибка

private _setError(string $file, string $class, string $function, int $line, string $sql, int $error) : void
Parameters
$file : string
$class : string
$function : string
$line : int
$sql : string
$error : int

GetNodeInfo()

Receives left, right and level for unit with number id.

private GetNodeInfo(int $section_id) : array<string|int, mixed>|null
Parameters
$section_id : int

Unique section id

Return values
array<string|int, mixed>|null
  • left, right, level

        
On this page

Search results