Example #1
0
 public function setParent(Composite $parent)
 {
     $this->parentNode = $parent;
     if (!$parent->contains($this)) {
         $parent->append($this);
     }
 }
Example #2
0
 /**
  * Remove esse componente da lista de filhos de seu pai.
  * @return	Component Uma referência ao próprio Component
  * @throws	BadMethodCallException Se esse componente não possuir
  * 			um pai.
  */
 public function setOrphan()
 {
     if ($this->parent !== null) {
         if ($this->parent->contains($this)) {
             $this->parent->removeChild($this);
         }
         $this->parent = null;
         return $this;
     } else {
         throw new BadMethodCallException('Esse componente não possui um pai.');
     }
 }