Perform deep clone when cloning a part.

Fixes issue #25.
This commit is contained in:
Jan Böhmer 2020-03-08 18:56:00 +01:00
parent ccdac1a94b
commit a3c626d0ab
8 changed files with 92 additions and 7 deletions

View file

@ -348,4 +348,18 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface
return $this;
}
public function __clone()
{
if ($this->id) {
$this->addedDate = null;
$pricedetails = $this->pricedetails;
$this->pricedetails = new ArrayCollection();
//Set master attachment is needed
foreach ($pricedetails as $pricedetail) {
$this->addPricedetail(clone $pricedetail);
}
}
parent::__clone();
}
}

View file

@ -328,4 +328,12 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
{
return 'PD'.sprintf('%06d', $this->getID());
}
public function __clone()
{
if ($this->id) {
$this->addedDate = null;
}
parent::__clone();
}
}