PHP Class Baum\Move

Afficher le fichier Open project: gazsp/baum Class Usage Examples

Protected Properties

Свойство Type Description
$_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.

Méthodes publiques

Méthode Description
__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.

Méthodes protégées

Méthode Description
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.

Method Details

__construct() public méthode

Create a new Move class instance.
public __construct ( Node $node, Node | integer $target, string $position ) : void
$node Node
$target Node | integer
$position string
Résultat void

applyLockBetween() protected méthode

Applies a lock to the rows between the supplied index boundaries.
protected applyLockBetween ( integer $lft, integer $rgt ) : void
$lft integer
$rgt integer
Résultat void

bound1() protected méthode

Computes the boundary.
protected bound1 ( ) : integer
Résultat integer

bound2() protected méthode

TODO: Maybe find a better name for this... ¿?
protected bound2 ( ) : integer
Résultat integer

boundaries() protected méthode

Computes the boundaries array.
protected boundaries ( ) : array
Résultat array

fireMoveEvent() protected méthode

Fire the given move event for the model.
protected fireMoveEvent ( string $event, boolean $halt = true ) : mixed
$event string
$halt boolean
Résultat mixed

getEventDispatcher() public static méthode

Get the event dispatcher instance.
public static getEventDispatcher ( ) : Illuminate\Events\Dispatcher
Résultat Illuminate\Events\Dispatcher

guardAgainstImpossibleMove() protected méthode

Check wether the current move is possible and if not, rais an exception.
protected guardAgainstImpossibleMove ( ) : void
Résultat void

hasChange() protected méthode

Check wether there should be changes in the downward tree structure.
protected hasChange ( ) : boolean
Résultat boolean

parentId() protected méthode

Computes the new parent id for the node being moved.
protected parentId ( ) : integer
Résultat integer

perform() public méthode

Perform the move operation.
public perform ( ) : Node
Résultat Node

promotingToRoot() protected méthode

Check if we are promoting the provided instance to a root node.
protected promotingToRoot ( ) : boolean
Résultat boolean

quoteIdentifier() protected méthode

Quotes an identifier for being used in a database query.
protected quoteIdentifier ( mixed $value ) : string
$value mixed
Résultat string

resolveNode() protected méthode

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
Résultat Node

setEventDispatcher() public static méthode

Set the event dispatcher instance.
public static setEventDispatcher ( Illuminate\Events\Dispatcher $dispatcher = null ) : void
$dispatcher Illuminate\Events\Dispatcher
Résultat void

to() public static méthode

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
Résultat Node

updateStructure() public méthode

Runs the SQL query associated with the update of the indexes affected by the move operation.
public updateStructure ( ) : integer
Résultat integer

Property Details

$_bound1 protected_oe property

Memoized 1st boundary.
protected int $_bound1
Résultat integer

$_bound2 protected_oe property

Memoized 2nd boundary.
protected int $_bound2
Résultat integer

$_boundaries protected_oe property

Memoized boundaries array.
protected array $_boundaries
Résultat array

$dispatcher protected_oe static_oe property

The event dispatcher instance.
protected static Dispatcher,Illuminate\Events $dispatcher
Résultat Illuminate\Events\Dispatcher

$node protected_oe property

Node on which the move operation will be performed.
protected Node,Baum $node
Résultat Node

$position protected_oe property

Move target position, one of: child, left, right, root.
protected string $position
Résultat string

$target protected_oe property

Destination node.
protected $target