mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-24 18:58:46 +02:00
Applied symplify rules to codebase.
This commit is contained in:
parent
2f20d90041
commit
388e847b17
136 changed files with 1370 additions and 789 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue