mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-10 15:12:12 +00:00
Do not change EDA info of original category or footprint when cloning
Fixes #1341. We have to clone the eda info on duplicaion
This commit is contained in:
parent
2a6f6f4ed5
commit
3ef4a83f4a
2 changed files with 18 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
****************************************/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue