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

@ -55,6 +55,7 @@ use App\Entity\Attachments\DeviceAttachment;
use App\Entity\Base\PartsContainingDBElement;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use InvalidArgumentException;
/**
* Class AttachmentType.
@ -64,12 +65,6 @@ use Doctrine\ORM\Mapping as ORM;
*/
class Device extends PartsContainingDBElement
{
/**
* @var Collection|DeviceAttachment[]
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\DeviceAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
*/
protected $attachments;
/**
* @ORM\OneToMany(targetEntity="Device", mappedBy="parent")
*/
@ -81,6 +76,11 @@ class Device extends PartsContainingDBElement
*/
protected $parent;
/**
* @ORM\OneToMany(targetEntity="DevicePart", mappedBy="device")
*/
protected $parts;
/**
* @var int
* @ORM\Column(type="integer")
@ -92,11 +92,11 @@ class Device extends PartsContainingDBElement
* @ORM\Column(type="boolean")
*/
protected $order_only_missing_parts = false;
/**
* @ORM\OneToMany(targetEntity="DevicePart", mappedBy="device")
* @var Collection|DeviceAttachment[]
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\DeviceAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
*/
protected $parts;
protected $attachments;
/********************************************************************************
*
@ -140,7 +140,7 @@ class Device extends PartsContainingDBElement
public function setOrderQuantity(int $new_order_quantity): self
{
if ($new_order_quantity < 0) {
throw new \InvalidArgumentException('The new order quantity must not be negative!');
throw new InvalidArgumentException('The new order quantity must not be negative!');
}
$this->order_quantity = $new_order_quantity;

View file

@ -63,6 +63,17 @@ use Doctrine\ORM\Mapping as ORM;
*/
class DevicePart extends DBElement
{
/**
* @var int
* @ORM\Column(type="integer", name="quantity")
*/
protected $quantity;
/**
* @var string
* @ORM\Column(type="text", name="mountnames")
*/
protected $mountnames;
/**
* @var Device
* @ORM\ManyToOne(targetEntity="Device", inversedBy="parts")
@ -77,18 +88,6 @@ class DevicePart extends DBElement
*/
protected $part;
/**
* @var int
* @ORM\Column(type="integer", name="quantity")
*/
protected $quantity;
/**
* @var string
* @ORM\Column(type="text", name="mountnames")
*/
protected $mountnames;
/**
* Returns the ID as an string, defined by the element class.
* This should have a form like P000014, for a part with ID 14.