Improved typing of properties

This commit is contained in:
Jan Böhmer 2023-04-15 22:25:03 +02:00
parent 29d1d49aca
commit 13209c3236
30 changed files with 78 additions and 61 deletions

View file

@ -24,6 +24,7 @@ namespace App\Entity\Parts;
use App\Entity\Attachments\CategoryAttachment;
use App\Entity\Base\AbstractPartsContainingDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Parameters\CategoryParameter;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
@ -46,13 +47,13 @@ class Category extends AbstractPartsContainingDBElement
* @ORM\OrderBy({"name" = "ASC"})
* @var Collection
*/
protected $children;
protected Collection $children;
/**
* @ORM\ManyToOne(targetEntity="Category", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent;
protected ?AbstractStructuralDBElement $parent = null;
/**
* @var string
@ -109,6 +110,7 @@ class Category extends AbstractPartsContainingDBElement
* @Groups({"full", "import"})
*/
protected string $default_comment = '';
/**
* @var Collection<int, CategoryAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
@ -116,7 +118,7 @@ class Category extends AbstractPartsContainingDBElement
* @Assert\Valid()
* @Groups({"full"})
*/
protected $attachments;
protected Collection $attachments;
/** @var Collection<int, CategoryParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\CategoryParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
@ -124,7 +126,7 @@ class Category extends AbstractPartsContainingDBElement
* @Assert\Valid()
* @Groups({"full"})
*/
protected $parameters;
protected Collection $parameters;
public function getPartnameHint(): string
{

View file

@ -51,7 +51,7 @@ class Footprint extends AbstractPartsContainingDBElement
* @ORM\OrderBy({"name" = "ASC"})
* @var Collection
*/
protected $children;
protected Collection $children;
/**
* @var Collection<int, FootprintAttachment>
@ -59,7 +59,7 @@ class Footprint extends AbstractPartsContainingDBElement
* @ORM\OrderBy({"name" = "ASC"})
* @Assert\Valid()
*/
protected $attachments;
protected Collection $attachments;
/**
* @var FootprintAttachment|null
@ -73,7 +73,7 @@ class Footprint extends AbstractPartsContainingDBElement
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Assert\Valid()
*/
protected $parameters;
protected Collection $parameters;
/****************************************
* Getters

View file

@ -51,7 +51,7 @@ class Manufacturer extends AbstractCompany
* @ORM\OrderBy({"name" = "ASC"})
* @var Collection
*/
protected $children;
protected Collection $children;
/**
* @var Collection<int, ManufacturerAttachment>
@ -59,12 +59,12 @@ class Manufacturer extends AbstractCompany
* @ORM\OrderBy({"name" = "ASC"})
* @Assert\Valid()
*/
protected $attachments;
protected Collection $attachments;
/** @var Collection<int, ManufacturerParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\ManufacturerParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Assert\Valid()
*/
protected $parameters;
protected Collection $parameters;
}

View file

@ -75,7 +75,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
* @ORM\OrderBy({"name" = "ASC"})
* @var Collection
*/
protected $children;
protected Collection $children;
/**
* @ORM\ManyToOne(targetEntity="MeasurementUnit", inversedBy="children")
@ -89,14 +89,14 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
* @ORM\OrderBy({"name" = "ASC"})
* @Assert\Valid()
*/
protected $attachments;
protected Collection $attachments;
/** @var Collection<int, MeasurementUnitParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\MeasurementUnitParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Assert\Valid()
*/
protected $parameters;
protected Collection $parameters;
/**
* @return string

View file

@ -75,7 +75,7 @@ class Part extends AttachmentContainingDBElement
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Groups({"full"})
*/
protected $parameters;
protected Collection $parameters;
/**
* @ORM\Column(type="datetime", name="datetime_added", options={"default":"CURRENT_TIMESTAMP"})
@ -100,7 +100,7 @@ class Part extends AttachmentContainingDBElement
* @Assert\Valid()
* @Groups({"full"})
*/
protected $attachments;
protected Collection $attachments;
/**
* @var DateTime|null the date when this element was modified the last time

View file

@ -24,6 +24,7 @@ namespace App\Entity\Parts;
use App\Entity\Attachments\StorelocationAttachment;
use App\Entity\Base\AbstractPartsContainingDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Parameters\StorelocationParameter;
use App\Entity\UserSystem\User;
use Doctrine\Common\Collections\Collection;
@ -47,13 +48,13 @@ class Storelocation extends AbstractPartsContainingDBElement
* @ORM\OrderBy({"name" = "ASC"})
* @var Collection
*/
protected $children;
protected Collection $children;
/**
* @ORM\ManyToOne(targetEntity="Storelocation", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent;
protected ?AbstractStructuralDBElement $parent;
/**
* @var MeasurementUnit|null The measurement unit, which parts can be stored in here
@ -67,7 +68,7 @@ class Storelocation extends AbstractPartsContainingDBElement
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Assert\Valid()
*/
protected $parameters;
protected Collection $parameters;
/**
* @var bool
@ -109,7 +110,7 @@ class Storelocation extends AbstractPartsContainingDBElement
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @Assert\Valid()
*/
protected $attachments;
protected Collection $attachments;
/********************************************************************************
*

View file

@ -24,6 +24,7 @@ namespace App\Entity\Parts;
use App\Entity\Attachments\SupplierAttachment;
use App\Entity\Base\AbstractCompany;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Parameters\SupplierParameter;
use App\Entity\PriceInformations\Currency;
use App\Validator\Constraints\BigDecimal\BigDecimalPositiveOrZero;
@ -50,18 +51,18 @@ class Supplier extends AbstractCompany
* @ORM\OrderBy({"name" = "ASC"})
* @var Collection
*/
protected $children;
protected Collection $children;
/**
* @ORM\ManyToOne(targetEntity="Supplier", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent;
protected ?AbstractStructuralDBElement $parent;
/**
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="supplier")
*/
protected $orderdetails;
protected Collection $orderdetails;
/**
* @var Currency|null The currency that should be used by default for order informations with this supplier.
@ -86,14 +87,14 @@ class Supplier extends AbstractCompany
* @ORM\OrderBy({"name" = "ASC"})
* @Assert\Valid()
*/
protected $attachments;
protected Collection $attachments;
/** @var Collection<int, SupplierParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\SupplierParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Assert\Valid()
*/
protected $parameters;
protected Collection $parameters;
/**
* Gets the currency that should be used by default, when creating a orderdetail with this supplier.