/** * Assign a new owner to the properties object. This will also do a deep clone of the component's properties. * * @param Component $owner */ function setComponent(Component $owner) { $this->component = $owner; $props = $this->getPropertiesOf(type::content); foreach ($props as $name => $value) { if (!is_null($value)) { /** @var Component $c */ $c = clone $value; $c->attachTo($owner); $this->{$name} = $c; } } $props = $this->getPropertiesOf(type::collection); foreach ($props as $name => $values) { if (!empty($values)) { $this->{$name} = Component::cloneComponents($values, $owner); } } }