diff --git a/src/Entity/Parts/Category.php b/src/Entity/Parts/Category.php index 7fca81bc..22f8a3e4 100644 --- a/src/Entity/Parts/Category.php +++ b/src/Entity/Parts/Category.php @@ -208,6 +208,15 @@ class Category extends AbstractPartsContainingDBElement $this->eda_info = new EDACategoryInfo(); } + public function __clone() + { + if ($this->id) { + //Clone EDA info to prevent changes to the original EDA info when changing the cloned category + $this->eda_info = clone $this->eda_info; + } + parent::__clone(); + } + public function getPartnameHint(): string { return $this->partname_hint; diff --git a/src/Entity/Parts/Footprint.php b/src/Entity/Parts/Footprint.php index 6b043562..3d8be686 100644 --- a/src/Entity/Parts/Footprint.php +++ b/src/Entity/Parts/Footprint.php @@ -152,6 +152,15 @@ class Footprint extends AbstractPartsContainingDBElement $this->eda_info = new EDAFootprintInfo(); } + public function __clone() + { + if ($this->id) { + //Clone EDA info to prevent changes to the original EDA info when changing the cloned category + $this->eda_info = clone $this->eda_info; + } + parent::__clone(); + } + /**************************************** * Getters ****************************************/