public function __clone() { $clone = new self($this->getName(), $this->getMetadata(), $this->getDefaultTypeName(), $this->getMandatory(), $this->getMultilingual(), $this->getMaxOccurs(), $this->getMinOccurs(), $this->getParams()); $clone->types = []; foreach ($this->types as $type) { $clone->addType(clone $type); } $clone->setValue($this->getValue()); return $clone; }