mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 10:24:31 +02:00
parent
ccdac1a94b
commit
a3c626d0ab
8 changed files with 92 additions and 7 deletions
|
@ -156,4 +156,24 @@ class Part extends AttachmentContainingDBElement
|
|||
{
|
||||
return $this->devices;
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
if ($this->id) {
|
||||
//Deep clone part lots
|
||||
$lots = $this->partLots;
|
||||
$this->partLots = new ArrayCollection();
|
||||
foreach ($lots as $lot) {
|
||||
$this->addPartLot(clone $lot);
|
||||
}
|
||||
|
||||
//Deep clone order details
|
||||
$orderdetails = $this->orderdetails;
|
||||
$this->orderdetails = new ArrayCollection();
|
||||
foreach ($orderdetails as $orderdetail) {
|
||||
$this->addOrderdetail(clone $orderdetail);
|
||||
}
|
||||
}
|
||||
parent::__clone();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,4 +325,12 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
if($this->id) {
|
||||
$this->addedDate = null;
|
||||
}
|
||||
parent::__clone();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue