Acl\Shell\AclShell::setParent PHP Method

setParent() public method

Set parent for an ARO/ACO node.
public setParent ( ) : void
return void
    public function setParent()
    {
        extract($this->_dataVars());
        $target = $this->parseIdentifier($this->args[1]);
        $parent = $this->parseIdentifier($this->args[2]);
        $data = ['id' => $this->_getNodeId($class, $target), 'parent_id' => $this->_getNodeId($class, $parent)];
        $entity = $this->Acl->{$class}->newEntity($data);
        if (!$this->Acl->{$class}->save($entity)) {
            $this->out(__d('cake_acl', 'Error in setting new parent. Please make sure the parent node exists, and is not a descendant of the node specified.'));
        } else {
            $this->out(__d('cake_acl', 'Node parent set to {0}', [$this->args[2]]) . "\n");
        }
    }