mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 02:14:31 +02:00
Use typed properties
This commit is contained in:
parent
548ec2ea50
commit
51e05a8669
216 changed files with 603 additions and 698 deletions
|
@ -54,49 +54,49 @@ class Category extends AbstractPartsContainingDBElement
|
|||
* @var string
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
protected $partname_hint = '';
|
||||
protected string $partname_hint = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
protected $partname_regex = '';
|
||||
protected string $partname_regex = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $disable_footprints = false;
|
||||
protected bool $disable_footprints = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $disable_manufacturers = false;
|
||||
protected bool $disable_manufacturers = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $disable_autodatasheets = false;
|
||||
protected bool $disable_autodatasheets = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $disable_properties = false;
|
||||
protected bool $disable_properties = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
protected $default_description = '';
|
||||
protected string $default_description = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
protected $default_comment = '';
|
||||
protected string $default_comment = '';
|
||||
/**
|
||||
* @var Collection<int, CategoryAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
|
|
|
@ -91,7 +91,7 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\FootprintAttachment")
|
||||
* @ORM\JoinColumn(name="id_footprint_3d", referencedColumnName="id")
|
||||
*/
|
||||
protected $footprint_3d;
|
||||
protected ?FootprintAttachment $footprint_3d = null;
|
||||
|
||||
/** @var Collection<int, FootprintParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\FootprintParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
|
|
|
@ -66,14 +66,14 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
* @ORM\Column(type="string", name="unit", nullable=true)
|
||||
* @Assert\Length(max=10)
|
||||
*/
|
||||
protected $unit;
|
||||
protected string $unit;
|
||||
|
||||
/**
|
||||
* @var bool Determines if the amount value associated with this unit should be treated as integer.
|
||||
* Set to false, to measure continuous sizes likes masses or lengths.
|
||||
* @ORM\Column(type="boolean", name="is_integer")
|
||||
*/
|
||||
protected $is_integer = false;
|
||||
protected bool $is_integer = false;
|
||||
|
||||
/**
|
||||
* @var bool Determines if the unit can be used with SI Prefixes (kilo, giga, milli, etc.).
|
||||
|
@ -81,7 +81,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
* @ORM\Column(type="boolean", name="use_si_prefix")
|
||||
* @Assert\Expression("this.isUseSIPrefix() == false or this.getUnit() != null", message="validator.measurement_unit.use_si_prefix_needs_unit")
|
||||
*/
|
||||
protected $use_si_prefix = false;
|
||||
protected bool $use_si_prefix = false;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="MeasurementUnit", mappedBy="parent", cascade={"persist"})
|
||||
|
|
|
@ -103,7 +103,7 @@ class Part extends AttachmentContainingDBElement
|
|||
* @ColumnSecurity(type="datetime")
|
||||
* @ORM\Column(type="datetime", name="datetime_added", options={"default"="CURRENT_TIMESTAMP"})
|
||||
*/
|
||||
protected $addedDate;
|
||||
protected ?DateTime $addedDate = null;
|
||||
|
||||
/** *************************************************************
|
||||
* Overridden properties
|
||||
|
@ -115,7 +115,7 @@ class Part extends AttachmentContainingDBElement
|
|||
* @ORM\Column(type="string")
|
||||
* @ColumnSecurity(prefix="name")
|
||||
*/
|
||||
protected $name = '';
|
||||
protected string $name = '';
|
||||
|
||||
/**
|
||||
* @var Collection<int, PartAttachment>
|
||||
|
@ -131,7 +131,7 @@ class Part extends AttachmentContainingDBElement
|
|||
* @ColumnSecurity(type="datetime")
|
||||
* @ORM\Column(type="datetime", name="last_modified", options={"default"="CURRENT_TIMESTAMP"})
|
||||
*/
|
||||
protected $lastModified;
|
||||
protected ?DateTime $lastModified = null;
|
||||
|
||||
/**
|
||||
* @var Attachment
|
||||
|
@ -139,7 +139,7 @@ class Part extends AttachmentContainingDBElement
|
|||
* @ORM\JoinColumn(name="id_preview_attachement", referencedColumnName="id")
|
||||
* @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture")
|
||||
*/
|
||||
protected $master_picture_attachment;
|
||||
protected ?Attachment $master_picture_attachment = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -70,20 +70,20 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
* @var string A short description about this lot, shown in table
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
protected $description = '';
|
||||
protected string $description = '';
|
||||
|
||||
/**
|
||||
* @var string a comment stored with this lot
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
protected $comment = '';
|
||||
protected string $comment = '';
|
||||
|
||||
/**
|
||||
* @var ?DateTime Set a time until when the lot must be used.
|
||||
* Set to null, if the lot can be used indefinitely.
|
||||
* @ORM\Column(type="datetime", name="expiration_date", nullable=true)
|
||||
*/
|
||||
protected $expiration_date;
|
||||
protected ?DateTime $expiration_date = null;
|
||||
|
||||
/**
|
||||
* @var Storelocation|null The storelocation of this lot
|
||||
|
@ -91,26 +91,26 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
* @ORM\JoinColumn(name="id_store_location", referencedColumnName="id", nullable=true)
|
||||
* @Selectable()
|
||||
*/
|
||||
protected $storage_location;
|
||||
protected ?Storelocation $storage_location = null;
|
||||
|
||||
/**
|
||||
* @var bool If this is set to true, the instock amount is marked as not known
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $instock_unknown = false;
|
||||
protected bool $instock_unknown = false;
|
||||
|
||||
/**
|
||||
* @var float For continuous sizes (length, volume, etc.) the instock is saved here.
|
||||
* @ORM\Column(type="float")
|
||||
* @Assert\PositiveOrZero()
|
||||
*/
|
||||
protected $amount = 0;
|
||||
protected float $amount = 0.0;
|
||||
|
||||
/**
|
||||
* @var bool determines if this lot was manually marked for refilling
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $needs_refill = false;
|
||||
protected bool $needs_refill = false;
|
||||
|
||||
/**
|
||||
* @var Part The part that is stored in this lot
|
||||
|
@ -118,7 +118,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
* @ORM\JoinColumn(name="id_part", referencedColumnName="id", nullable=false, onDelete="CASCADE")
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
protected $part;
|
||||
protected Part $part;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
|
|
|
@ -57,14 +57,14 @@ trait AdvancedPropertyTrait
|
|||
* @ORM\Column(type="boolean")
|
||||
* @ColumnSecurity(type="boolean")
|
||||
*/
|
||||
protected $needs_review = false;
|
||||
protected bool $needs_review = false;
|
||||
|
||||
/**
|
||||
* @var string a comma separated list of tags, associated with the part
|
||||
* @ORM\Column(type="text")
|
||||
* @ColumnSecurity(type="string", prefix="tags", placeholder="")
|
||||
*/
|
||||
protected $tags = '';
|
||||
protected string $tags = '';
|
||||
|
||||
/**
|
||||
* @var float|null how much a single part unit weighs in grams
|
||||
|
@ -72,7 +72,7 @@ trait AdvancedPropertyTrait
|
|||
* @ColumnSecurity(type="float", placeholder=null)
|
||||
* @Assert\PositiveOrZero()
|
||||
*/
|
||||
protected $mass;
|
||||
protected ?float $mass = null;
|
||||
|
||||
/**
|
||||
* Checks if this part is marked, for that it needs further review.
|
||||
|
|
|
@ -56,27 +56,27 @@ trait BasicPropertyTrait
|
|||
* @ORM\Column(type="text")
|
||||
* @ColumnSecurity(prefix="description")
|
||||
*/
|
||||
protected $description = '';
|
||||
protected string $description = '';
|
||||
|
||||
/**
|
||||
* @var string A comment/note related to this part
|
||||
* @ORM\Column(type="text")
|
||||
* @ColumnSecurity(prefix="comment")
|
||||
*/
|
||||
protected $comment = '';
|
||||
protected string $comment = '';
|
||||
|
||||
/**
|
||||
* @var bool Kept for compatibility (it is not used now, and I dont think it was used in old versions)
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $visible = true;
|
||||
protected bool $visible = true;
|
||||
|
||||
/**
|
||||
* @var bool true, if the part is marked as favorite
|
||||
* @ORM\Column(type="boolean")
|
||||
* @ColumnSecurity(type="boolean")
|
||||
*/
|
||||
protected $favorite = false;
|
||||
protected bool $favorite = false;
|
||||
|
||||
/**
|
||||
* @var Category The category this part belongs too (e.g. Resistors). Use tags, for more complex grouping.
|
||||
|
@ -87,7 +87,7 @@ trait BasicPropertyTrait
|
|||
* @Selectable()
|
||||
* @Assert\NotNull(message="validator.select_valid_category")
|
||||
*/
|
||||
protected $category;
|
||||
protected ?Category $category = null;
|
||||
|
||||
/**
|
||||
* @var Footprint|null The footprint of this part (e.g. DIP8)
|
||||
|
@ -96,7 +96,7 @@ trait BasicPropertyTrait
|
|||
* @ColumnSecurity(prefix="footprint", type="App\Entity\Parts\Footprint")
|
||||
* @Selectable()
|
||||
*/
|
||||
protected $footprint;
|
||||
protected ?Footprint $footprint = null;
|
||||
|
||||
/**
|
||||
* Get the description string like it is saved in the database.
|
||||
|
|
|
@ -70,7 +70,7 @@ trait InstockTrait
|
|||
* @Assert\PositiveOrZero()
|
||||
* @ColumnSecurity(prefix="minamount", type="integer")
|
||||
*/
|
||||
protected $minamount = 0;
|
||||
protected float $minamount = 0;
|
||||
|
||||
/**
|
||||
* @var ?MeasurementUnit the unit in which the part's amount is measured
|
||||
|
@ -78,7 +78,7 @@ trait InstockTrait
|
|||
* @ORM\JoinColumn(name="id_part_unit", referencedColumnName="id", nullable=true)
|
||||
* @ColumnSecurity(type="object", prefix="unit")
|
||||
*/
|
||||
protected $partUnit;
|
||||
protected ?MeasurementUnit $partUnit = null;
|
||||
|
||||
/**
|
||||
* Get all part lots where this part is stored.
|
||||
|
|
|
@ -61,7 +61,7 @@ trait ManufacturerTrait
|
|||
* @ColumnSecurity(prefix="manufacturer", type="App\Entity\Parts\Manufacturer")
|
||||
* @Selectable()
|
||||
*/
|
||||
protected $manufacturer;
|
||||
protected ?Manufacturer $manufacturer = null;
|
||||
|
||||
/**
|
||||
* @var string the url to the part on the manufacturer's homepage
|
||||
|
@ -69,14 +69,14 @@ trait ManufacturerTrait
|
|||
* @Assert\Url()
|
||||
* @ColumnSecurity(prefix="mpn", type="string", placeholder="")
|
||||
*/
|
||||
protected $manufacturer_product_url = '';
|
||||
protected string $manufacturer_product_url = '';
|
||||
|
||||
/**
|
||||
* @var string The product number used by the manufacturer. If this is set to "", the name field is used.
|
||||
* @ORM\Column(type="string")
|
||||
* @ColumnSecurity(prefix="mpn", type="string", placeholder="")
|
||||
*/
|
||||
protected $manufacturer_product_number = '';
|
||||
protected string $manufacturer_product_number = '';
|
||||
|
||||
/**
|
||||
* @var string The production status of this part. Can be one of the specified ones.
|
||||
|
@ -84,7 +84,7 @@ trait ManufacturerTrait
|
|||
* @Assert\Choice({"announced", "active", "nrfnd", "eol", "discontinued", ""})
|
||||
* @ColumnSecurity(type="string", prefix="status", placeholder="")
|
||||
*/
|
||||
protected $manufacturing_status = '';
|
||||
protected string $manufacturing_status = '';
|
||||
|
||||
/**
|
||||
* Get the link to the website of the article on the manufacturers website
|
||||
|
|
|
@ -69,14 +69,14 @@ trait OrderTrait
|
|||
* @ORM\Column(type="integer")
|
||||
* @ColumnSecurity(prefix="order", type="integer")
|
||||
*/
|
||||
protected $order_quantity = 0;
|
||||
protected int $order_quantity = 0;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @ColumnSecurity(prefix="order", type="boolean")
|
||||
*/
|
||||
protected $manual_order = false;
|
||||
protected bool $manual_order = false;
|
||||
|
||||
/**
|
||||
* @var Orderdetail
|
||||
|
@ -85,7 +85,7 @@ trait OrderTrait
|
|||
*
|
||||
* @ColumnSecurity(prefix="order", type="object")
|
||||
*/
|
||||
protected $order_orderdetail;
|
||||
protected Orderdetail $order_orderdetail;
|
||||
|
||||
/**
|
||||
* Get the selected order orderdetails of this part.
|
||||
|
|
|
@ -83,7 +83,7 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
* @ORM\ManyToOne(targetEntity="MeasurementUnit")
|
||||
* @ORM\JoinColumn(name="storage_type_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $storage_type;
|
||||
protected ?MeasurementUnit $storage_type = null;
|
||||
|
||||
/** @var Collection<int, StorelocationParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\StorelocationParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
|
@ -96,19 +96,19 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $is_full = false;
|
||||
protected bool $is_full = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $only_single_part = false;
|
||||
protected bool $only_single_part = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $limit_to_existing_parts = false;
|
||||
protected bool $limit_to_existing_parts = false;
|
||||
/**
|
||||
* @var Collection<int, StorelocationAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
|
|
|
@ -94,14 +94,14 @@ class Supplier extends AbstractCompany
|
|||
* @ORM\JoinColumn(name="default_currency_id", referencedColumnName="id", nullable=true)
|
||||
* @Selectable()
|
||||
*/
|
||||
protected $default_currency;
|
||||
protected ?Currency $default_currency = null;
|
||||
|
||||
/**
|
||||
* @var BigDecimal|null the shipping costs that have to be paid, when ordering via this supplier
|
||||
* @ORM\Column(name="shipping_costs", nullable=true, type="big_decimal", precision=11, scale=5)
|
||||
* @BigDecimalPositiveOrZero()
|
||||
*/
|
||||
protected $shipping_costs;
|
||||
protected ?BigDecimal $shipping_costs = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, SupplierAttachment>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue