Applied symplify rules to codebase.

This commit is contained in:
Jan Böhmer 2020-01-05 22:49:00 +01:00
parent 2f20d90041
commit 388e847b17
136 changed files with 1370 additions and 789 deletions

View file

@ -43,10 +43,12 @@ class Currency extends StructuralDBElement
public const PRICE_SCALE = 5;
/**
* @var Collection|CurrencyAttachment[]
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CurrencyAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @var string|null The exchange rate between this currency and the base currency
* (how many base units the current currency is worth)
* @ORM\Column(type="decimal", precision=11, scale=5, nullable=true)
* @Assert\Positive()
*/
protected $attachments;
protected $exchange_rate;
/**
* @var string the 3 letter ISO code of the currency
@ -55,14 +57,6 @@ class Currency extends StructuralDBElement
*/
protected $iso_code;
/**
* @var string|null The exchange rate between this currency and the base currency
* (how many base units the current currency is worth)
* @ORM\Column(type="decimal", precision=11, scale=5, nullable=true)
* @Assert\Positive()
*/
protected $exchange_rate;
/**
* @ORM\OneToMany(targetEntity="Currency", mappedBy="parent", cascade={"persist"})
*/
@ -74,6 +68,12 @@ class Currency extends StructuralDBElement
*/
protected $parent;
/**
* @var Collection|CurrencyAttachment[]
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CurrencyAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
*/
protected $attachments;
/**
* Returns the 3 letter ISO code of this currency.
*

View file

@ -71,21 +71,6 @@ class Orderdetail extends DBElement
{
use TimestampTrait;
/**
* @var Part
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="orderdetails")
* @ORM\JoinColumn(name="part_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
* @Assert\NotNull()
*/
protected $part;
/**
* @var Supplier
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="orderdetails")
* @ORM\JoinColumn(name="id_supplier", referencedColumnName="id")
*/
protected $supplier;
/**
* @ORM\OneToMany(targetEntity="Pricedetail", mappedBy="orderdetail", cascade={"persist", "remove"}, orphanRemoval=true)
* @Assert\Valid()
@ -112,6 +97,21 @@ class Orderdetail extends DBElement
*/
protected $supplier_product_url = '';
/**
* @var Part
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="orderdetails")
* @ORM\JoinColumn(name="part_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
* @Assert\NotNull()
*/
protected $part;
/**
* @var Supplier
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="orderdetails")
* @ORM\JoinColumn(name="id_supplier", referencedColumnName="id")
*/
protected $supplier;
public function __construct()
{
$this->pricedetails = new ArrayCollection();

View file

@ -72,14 +72,6 @@ class Pricedetail extends DBElement
public const PRICE_PRECISION = 5;
/**
* @var Orderdetail
* @ORM\ManyToOne(targetEntity="Orderdetail", inversedBy="pricedetails")
* @ORM\JoinColumn(name="orderdetails_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
* @Assert\NotNull()
*/
protected $orderdetail;
/**
* @var string The price related to the detail. (Given in the selected currency)
* @ORM\Column(type="decimal", precision=11, scale=5)
@ -116,6 +108,14 @@ class Pricedetail extends DBElement
*/
protected $manual_input = true;
/**
* @var Orderdetail
* @ORM\ManyToOne(targetEntity="Orderdetail", inversedBy="pricedetails")
* @ORM\JoinColumn(name="orderdetails_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
* @Assert\NotNull()
*/
protected $orderdetail;
public function __construct()
{
bcscale(static::PRICE_PRECISION);
@ -280,6 +280,7 @@ class Pricedetail extends DBElement
* quantity to 100. The single price (20$/100 = 0.2$) will be calculated automatically.
*
* @param float $new_price_related_quantity the price related quantity
*
* @return $this
*/
public function setPriceRelatedQuantity(float $new_price_related_quantity): self