PHP Класс Baum\Move

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_bound1 integer Memoized 1st boundary.
$_bound2 integer Memoized 2nd boundary.
$_boundaries array Memoized boundaries array.
$dispatcher Illuminate\Events\Dispatcher The event dispatcher instance.
$node Node Node on which the move operation will be performed.
$position string Move target position, one of: child, left, right, root.
$target Destination node.

Открытые методы

Метод Описание
__construct ( Node $node, Node | integer $target, string $position ) : void Create a new Move class instance.
getEventDispatcher ( ) : Illuminate\Events\Dispatcher Get the event dispatcher instance.
perform ( ) : Node Perform the move operation.
setEventDispatcher ( Illuminate\Events\Dispatcher $dispatcher = null ) : void Set the event dispatcher instance.
to ( Node $node, Node | integer $target, string $position ) : Node Easy static accessor for performing a move operation.
updateStructure ( ) : integer Runs the SQL query associated with the update of the indexes affected by the move operation.

Защищенные методы

Метод Описание
applyLockBetween ( integer $lft, integer $rgt ) : void Applies a lock to the rows between the supplied index boundaries.
bound1 ( ) : integer Computes the boundary.
bound2 ( ) : integer Computes the other boundary.
boundaries ( ) : array Computes the boundaries array.
fireMoveEvent ( string $event, boolean $halt = true ) : mixed Fire the given move event for the model.
guardAgainstImpossibleMove ( ) : void Check wether the current move is possible and if not, rais an exception.
hasChange ( ) : boolean Check wether there should be changes in the downward tree structure.
parentId ( ) : integer Computes the new parent id for the node being moved.
promotingToRoot ( ) : boolean Check if we are promoting the provided instance to a root node.
quoteIdentifier ( mixed $value ) : string Quotes an identifier for being used in a database query.
resolveNode ( $node ) : Node Resolves suplied node. Basically returns the node unchanged if supplied parameter is an instance of \Baum\Node. Otherwise it will try to find the node in the database.

Описание методов

__construct() публичный Метод

Create a new Move class instance.
public __construct ( Node $node, Node | integer $target, string $position ) : void
$node Node
$target Node | integer
$position string
Результат void

applyLockBetween() защищенный Метод

Applies a lock to the rows between the supplied index boundaries.
protected applyLockBetween ( integer $lft, integer $rgt ) : void
$lft integer
$rgt integer
Результат void

bound1() защищенный Метод

Computes the boundary.
protected bound1 ( ) : integer
Результат integer

bound2() защищенный Метод

TODO: Maybe find a better name for this... ¿?
protected bound2 ( ) : integer
Результат integer

boundaries() защищенный Метод

Computes the boundaries array.
protected boundaries ( ) : array
Результат array

fireMoveEvent() защищенный Метод

Fire the given move event for the model.
protected fireMoveEvent ( string $event, boolean $halt = true ) : mixed
$event string
$halt boolean
Результат mixed

getEventDispatcher() публичный статический Метод

Get the event dispatcher instance.
public static getEventDispatcher ( ) : Illuminate\Events\Dispatcher
Результат Illuminate\Events\Dispatcher

guardAgainstImpossibleMove() защищенный Метод

Check wether the current move is possible and if not, rais an exception.
protected guardAgainstImpossibleMove ( ) : void
Результат void

hasChange() защищенный Метод

Check wether there should be changes in the downward tree structure.
protected hasChange ( ) : boolean
Результат boolean

parentId() защищенный Метод

Computes the new parent id for the node being moved.
protected parentId ( ) : integer
Результат integer

perform() публичный Метод

Perform the move operation.
public perform ( ) : Node
Результат Node

promotingToRoot() защищенный Метод

Check if we are promoting the provided instance to a root node.
protected promotingToRoot ( ) : boolean
Результат boolean

quoteIdentifier() защищенный Метод

Quotes an identifier for being used in a database query.
protected quoteIdentifier ( mixed $value ) : string
$value mixed
Результат string

resolveNode() защищенный Метод

Resolves suplied node. Basically returns the node unchanged if supplied parameter is an instance of \Baum\Node. Otherwise it will try to find the node in the database.
protected resolveNode ( $node ) : Node
Результат Node

setEventDispatcher() публичный статический Метод

Set the event dispatcher instance.
public static setEventDispatcher ( Illuminate\Events\Dispatcher $dispatcher = null ) : void
$dispatcher Illuminate\Events\Dispatcher
Результат void

to() публичный статический Метод

Easy static accessor for performing a move operation.
public static to ( Node $node, Node | integer $target, string $position ) : Node
$node Node
$target Node | integer
$position string
Результат Node

updateStructure() публичный Метод

Runs the SQL query associated with the update of the indexes affected by the move operation.
public updateStructure ( ) : integer
Результат integer

Описание свойств

$_bound1 защищенное свойство

Memoized 1st boundary.
protected int $_bound1
Результат integer

$_bound2 защищенное свойство

Memoized 2nd boundary.
protected int $_bound2
Результат integer

$_boundaries защищенное свойство

Memoized boundaries array.
protected array $_boundaries
Результат array

$dispatcher защищенное статическое свойство

The event dispatcher instance.
protected static Dispatcher,Illuminate\Events $dispatcher
Результат Illuminate\Events\Dispatcher

$node защищенное свойство

Node on which the move operation will be performed.
protected Node,Baum $node
Результат Node

$position защищенное свойство

Move target position, one of: child, left, right, root.
protected string $position
Результат string

$target защищенное свойство

Destination node.
protected $target