Nette\ComponentModel\Component::__clone PHP Метод

__clone() публичный Метод

Object cloning.
public __clone ( )
    public function __clone()
    {
        if ($this->parent === NULL) {
            return;
        } elseif ($this->parent instanceof Container) {
            $this->parent = $this->parent->_isCloning();
            if ($this->parent === NULL) {
                // not cloning
                $this->refreshMonitors(0);
            }
        } else {
            $this->parent = NULL;
            $this->refreshMonitors(0);
        }
    }

Usage Example

Пример #1
0
 /**
  * Object cloning.
  */
 public function __clone()
 {
     if ($this->components) {
         $oldMyself = reset($this->components)->getParent();
         $oldMyself->cloning = $this;
         foreach ($this->components as $name => $component) {
             $this->components[$name] = clone $component;
         }
         $oldMyself->cloning = NULL;
     }
     parent::__clone();
 }