Fixed coding style.

This commit is contained in:
Jan Böhmer 2020-03-15 13:56:31 +01:00
parent 24939f2342
commit fd61c8d9e2
129 changed files with 962 additions and 1091 deletions

View file

@ -45,7 +45,6 @@ namespace App\Entity\PriceInformations;
use App\Entity\Attachments\CurrencyAttachment;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Parameters\CurrencyParameter;
use App\Entity\Parameters\SupplierParameter;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

View file

@ -117,6 +117,20 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface
$this->pricedetails = new ArrayCollection();
}
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();
}
/**
* Returns the ID as an string, defined by the element class.
* This should have a form like P000014, for a part with ID 14.
@ -228,7 +242,6 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface
/**
* Removes an pricedetail from this orderdetail.
*
* @param Pricedetail $pricedetail
* @return Orderdetail
*/
public function removePricedetail(Pricedetail $pricedetail): self
@ -276,7 +289,6 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface
/**
* Sets a new part with which this orderdetail is associated.
*
* @param Part $part
* @return Orderdetail
*/
public function setPart(Part $part): self
@ -289,7 +301,6 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface
/**
* Sets the new supplier associated with this orderdetail.
*
* @param Supplier $new_supplier
* @return Orderdetail
*/
public function setSupplier(Supplier $new_supplier): self
@ -348,18 +359,4 @@ 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

@ -121,6 +121,14 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
bcscale(static::PRICE_PRECISION);
}
public function __clone()
{
if ($this->id) {
$this->addedDate = null;
}
parent::__clone();
}
/********************************************************************************
*
* Getters
@ -230,7 +238,6 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
/**
* Sets the orderdetail to which this pricedetail belongs to.
*
* @param Orderdetail $orderdetail
* @return $this
*/
public function setOrderdetail(Orderdetail $orderdetail): self
@ -244,7 +251,6 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
* Sets the currency associated with the price informations.
* Set to null, to use the global base currency.
*
* @param Currency|null $currency
* @return Pricedetail
*/
public function setCurrency(?Currency $currency): self
@ -262,6 +268,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
* * This is the price for "price_related_quantity" parts!!
* * Example: if "price_related_quantity" is '10',
* you have to set here the price for 10 parts!
*
* @return $this
*/
public function setPrice(string $new_price): self
@ -309,6 +316,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
* So the orderdetails would have three Pricedetails for one supplier.)
*
* @param float $new_min_discount_quantity the minimum discount quantity
*
* @return $this
*/
public function setMinDiscountQuantity(float $new_min_discount_quantity): self
@ -328,12 +336,4 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
{
return 'PD'.sprintf('%06d', $this->getID());
}
public function __clone()
{
if ($this->id) {
$this->addedDate = null;
}
parent::__clone();
}
}