Xpressengine\Config\ConfigEntity::setParent PHP Method

setParent() public method

make hierarchy to upper
public setParent ( ConfigEntity $ancestor ) : void
$ancestor ConfigEntity config object
return void
    public function setParent(ConfigEntity $ancestor)
    {
        if ($this->isAdjacency($ancestor->name, $this->name)) {
            $this->parent = $ancestor;
        } else {
            if (is_null($this->parent)) {
                throw new NoParentException();
            }
            $this->parent->setParent($ancestor);
        }
    }

Usage Example

 /**
  * make hierarchy to upper
  *
  * @param ConfigEntity $ancestor config object
  * @return void
  * @throws NotHasParentException
  */
 public function setParent(ConfigEntity $ancestor)
 {
     if ($this->isAdjacency($ancestor->name, $this->name)) {
         $this->parent = $ancestor;
     } else {
         if (is_null($this->parent)) {
             throw new NotHasParentException('Parent is not exists');
         }
         $this->parent->setParent($ancestor);
     }
 }
All Usage Examples Of Xpressengine\Config\ConfigEntity::setParent