PHP 클래스 Baum\Move

파일 보기 프로젝트 열기: gazsp/baum 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_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