Baum\SetMapper::map PHP Method

map() public method

Maps a tree structure into the database. Unguards & wraps in transaction.
public map ( $nodeList ) : boolean
return boolean
    public function map($nodeList)
    {
        $self = $this;
        return $this->wrapInTransaction(function () use($self, $nodeList) {
            forward_static_call([get_class($self->node), 'unguard']);
            $result = $self->mapTree($nodeList);
            forward_static_call([get_class($self->node), 'reguard']);
            return $result;
        });
    }

Usage Example

Example #1
0
 /**
  * Maps the provided tree structure into the database using the current node
  * as the parent. The provided tree structure will be inserted/updated as the
  * descendancy subtree of the current node instance.
  *
  * @param   array|\Illuminate\Support\Contracts\ArrayableInterface
  *
  * @return  boolean
  */
 public function makeTree($nodeList)
 {
     $mapper = new SetMapper($this);
     return $mapper->map($nodeList);
 }