PHP Class Baum\SetMapper

显示文件 Open project: gazsp/baum Class Usage Examples

Protected Properties

Property Type Description
$childrenKeyName string Children key name.
$node Node Node instance for reference.

Public Methods

Method Description
__construct ( Node $node, $childrenKeyName = 'children' ) : void Create a new \Baum\SetBuilder class instance.
getChildrenKeyName ( ) : string Returns the children key name to use on the mapping array.
map ( $nodeList ) : boolean Maps a tree structure into the database. Unguards & wraps in transaction.
mapTree ( $nodeList ) : boolean Maps a tree structure into the database without unguarding nor wrapping inside a transaction.

Protected Methods

Method Description
deleteUnaffected ( $keys = [] )
firstOrNew ( $attributes )
getDataAttributes ( $attributes )
getSearchAttributes ( $attributes )
mapTreeRecursive ( array $tree, $parentKey = null, &$affectedKeys = [] ) : boolean Maps a tree structure into the database.
pruneScope ( )
wrapInTransaction ( Closure $callback )

Method Details

__construct() public method

Create a new \Baum\SetBuilder class instance.
public __construct ( Node $node, $childrenKeyName = 'children' ) : void
$node Node
return void

deleteUnaffected() protected method

protected deleteUnaffected ( $keys = [] )

firstOrNew() protected method

protected firstOrNew ( $attributes )

getChildrenKeyName() public method

Returns the children key name to use on the mapping array.
public getChildrenKeyName ( ) : string
return string

getDataAttributes() protected method

protected getDataAttributes ( $attributes )

getSearchAttributes() protected method

protected getSearchAttributes ( $attributes )

map() public method

Maps a tree structure into the database. Unguards & wraps in transaction.
public map ( $nodeList ) : boolean
return boolean

mapTree() public method

Maps a tree structure into the database without unguarding nor wrapping inside a transaction.
public mapTree ( $nodeList ) : boolean
return boolean

mapTreeRecursive() protected method

Maps a tree structure into the database.
protected mapTreeRecursive ( array $tree, $parentKey = null, &$affectedKeys = [] ) : boolean
$tree array
return boolean

pruneScope() protected method

protected pruneScope ( )

wrapInTransaction() protected method

protected wrapInTransaction ( Closure $callback )
$callback Closure

Property Details

$childrenKeyName protected_oe property

Children key name.
protected string $childrenKeyName
return string

$node protected_oe property

Node instance for reference.
protected Node,Baum $node
return Node