Jarves\Storage\AbstractStorage::add PHP Method

add() abstract public method

abstract public add ( array $values, array $targetPk = null, string $position = 'first', integer $scope = null ) : array
$values array
$targetPk array If nested set
$position string `first` (child), `last` (last child), `prev` (sibling), `next` (sibling)
$scope integer If nested set with scope
return array inserted/new primary key/s always as a array.
    public abstract function add($values, $targetPk = null, $position = 'first', $scope = null);

Usage Example

Example #1
0
 /**
  * {@inheritDoc}
  */
 public function add($values, $branchPk = false, $mode = 'into', $scope = 0)
 {
     $parentPath = null;
     if ($branchPk) {
         $parentPath = $this->getPathFromPK($branchPk);
     }
     $path = $parentPath ? $parentPath . $values['name'] : $values['name'];
     $this->webFilesystem->write($path, $values['content']);
     return parent::add($values, $branchPk, $mode, $scope);
 }