mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-12 14:09:31 +00:00
Use typed properties
This commit is contained in:
parent
548ec2ea50
commit
51e05a8669
216 changed files with 603 additions and 698 deletions
|
|
@ -17,26 +17,13 @@ class AttachmentFilter implements FilterInterface
|
|||
{
|
||||
use CompoundFilterTrait;
|
||||
|
||||
/** @var NumberConstraint */
|
||||
protected $dbId;
|
||||
|
||||
/** @var InstanceOfConstraint */
|
||||
protected $targetType;
|
||||
|
||||
/** @var TextConstraint */
|
||||
protected $name;
|
||||
|
||||
/** @var EntityConstraint */
|
||||
protected $attachmentType;
|
||||
|
||||
/** @var BooleanConstraint */
|
||||
protected $showInTable;
|
||||
|
||||
/** @var DateTimeConstraint */
|
||||
protected $lastModified;
|
||||
|
||||
/** @var DateTimeConstraint */
|
||||
protected $addedDate;
|
||||
protected NumberConstraint $dbId;
|
||||
protected InstanceOfConstraint $targetType;
|
||||
protected TextConstraint $name;
|
||||
protected EntityConstraint $attachmentType;
|
||||
protected BooleanConstraint $showInTable;
|
||||
protected DateTimeConstraint $lastModified;
|
||||
protected DateTimeConstraint $addedDate;
|
||||
|
||||
|
||||
public function __construct(NodesListBuilder $nodesListBuilder)
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ abstract class AbstractConstraint implements FilterInterface
|
|||
/**
|
||||
* @var string The property where this BooleanConstraint should apply to
|
||||
*/
|
||||
protected $property;
|
||||
protected string $property;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $identifier;
|
||||
protected string $identifier;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use Doctrine\ORM\QueryBuilder;
|
|||
class BooleanConstraint extends AbstractConstraint
|
||||
{
|
||||
/** @var bool|null The value of our constraint */
|
||||
protected $value;
|
||||
protected ?bool $value;
|
||||
|
||||
|
||||
public function __construct(string $property, string $identifier = null, ?bool $default_value = null)
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ class ChoiceConstraint extends AbstractConstraint
|
|||
/**
|
||||
* @var string[]|int[] The values to compare to
|
||||
*/
|
||||
protected $value;
|
||||
protected array $value;
|
||||
|
||||
/**
|
||||
* @var string The operator to use
|
||||
*/
|
||||
protected $operator;
|
||||
protected string $operator;
|
||||
|
||||
/**
|
||||
* @return string[]|int[]
|
||||
|
|
|
|||
|
|
@ -18,17 +18,17 @@ class EntityConstraint extends AbstractConstraint
|
|||
/**
|
||||
* @var NodesListBuilder
|
||||
*/
|
||||
protected $nodesListBuilder;
|
||||
protected ?NodesListBuilder $nodesListBuilder;
|
||||
|
||||
/**
|
||||
* @var class-string<T> The class to use for the comparison
|
||||
*/
|
||||
protected $class;
|
||||
protected string $class;
|
||||
|
||||
/**
|
||||
* @var string|null The operator to use
|
||||
*/
|
||||
protected $operator;
|
||||
protected ?string $operator;
|
||||
|
||||
/**
|
||||
* @var T The value to compare to
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use Doctrine\ORM\QueryBuilder;
|
|||
trait FilterTrait
|
||||
{
|
||||
|
||||
protected $useHaving = false;
|
||||
protected bool $useHaving = false;
|
||||
|
||||
public function useHaving($value = true): self
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@ class InstanceOfConstraint extends AbstractConstraint
|
|||
/**
|
||||
* @var string[] The values to compare to (fully qualified class names)
|
||||
*/
|
||||
protected $value;
|
||||
protected array $value;
|
||||
|
||||
/**
|
||||
* @var string The operator to use
|
||||
*/
|
||||
protected $operator;
|
||||
protected string $operator;
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class NumberConstraint extends AbstractConstraint
|
|||
/**
|
||||
* @var string The operator to use
|
||||
*/
|
||||
protected $operator;
|
||||
protected ?string $operator;
|
||||
|
||||
/**
|
||||
* @return float|int|null|\DateTimeInterface
|
||||
|
|
|
|||
|
|
@ -11,22 +11,22 @@ use Svg\Tag\Text;
|
|||
class ParameterConstraint extends AbstractConstraint
|
||||
{
|
||||
/** @var string */
|
||||
protected $name;
|
||||
protected string $name;
|
||||
|
||||
/** @var string */
|
||||
protected $symbol;
|
||||
protected string $symbol;
|
||||
|
||||
/** @var string */
|
||||
protected $unit;
|
||||
protected string $unit;
|
||||
|
||||
/** @var TextConstraint */
|
||||
protected $value_text;
|
||||
protected TextConstraint $value_text;
|
||||
|
||||
/** @var ParameterValueConstraint */
|
||||
protected $value;
|
||||
protected ParameterValueConstraint $value;
|
||||
|
||||
/** @var string The alias to use for the subquery */
|
||||
protected $alias;
|
||||
protected string $alias;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use Doctrine\ORM\QueryBuilder;
|
|||
|
||||
class ParameterValueConstraint extends NumberConstraint
|
||||
{
|
||||
protected $alias;
|
||||
protected string $alias;
|
||||
|
||||
public const ALLOWED_OPERATOR_VALUES = ['=', '!=', '<', '>', '<=', '>=', 'BETWEEN',
|
||||
//Additional operators
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class TagsConstraint extends AbstractConstraint
|
|||
/**
|
||||
* @var string|null The operator to use
|
||||
*/
|
||||
protected $operator;
|
||||
protected ?string $operator;
|
||||
|
||||
/**
|
||||
* @var string The value to compare to
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class TextConstraint extends AbstractConstraint
|
|||
/**
|
||||
* @var string|null The operator to use
|
||||
*/
|
||||
protected $operator;
|
||||
protected ?string $operator;
|
||||
|
||||
/**
|
||||
* @var string The value to compare to
|
||||
|
|
|
|||
|
|
@ -15,26 +15,13 @@ class LogFilter implements FilterInterface
|
|||
{
|
||||
use CompoundFilterTrait;
|
||||
|
||||
/** @var DateTimeConstraint */
|
||||
protected $timestamp;
|
||||
|
||||
/** @var IntConstraint */
|
||||
protected $dbId;
|
||||
|
||||
/** @var ChoiceConstraint */
|
||||
protected $level;
|
||||
|
||||
/** @var InstanceOfConstraint */
|
||||
protected $eventType;
|
||||
|
||||
/** @var ChoiceConstraint */
|
||||
protected $targetType;
|
||||
|
||||
/** @var IntConstraint */
|
||||
protected $targetId;
|
||||
|
||||
/** @var EntityConstraint */
|
||||
protected $user;
|
||||
protected DateTimeConstraint $timestamp;
|
||||
protected IntConstraint $dbId;
|
||||
protected ChoiceConstraint $level;
|
||||
protected InstanceOfConstraint $eventType;
|
||||
protected ChoiceConstraint $targetType;
|
||||
protected IntConstraint $targetId;
|
||||
protected EntityConstraint $user;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,104 +28,40 @@ class PartFilter implements FilterInterface
|
|||
|
||||
use CompoundFilterTrait;
|
||||
|
||||
/** @var NumberConstraint */
|
||||
protected $dbId;
|
||||
|
||||
/** @var TextConstraint */
|
||||
protected $name;
|
||||
|
||||
/** @var TextConstraint */
|
||||
protected $description;
|
||||
|
||||
/** @var TextConstraint */
|
||||
protected $comment;
|
||||
|
||||
/** @var TagsConstraint */
|
||||
protected $tags;
|
||||
|
||||
/** @var NumberConstraint */
|
||||
protected $minAmount;
|
||||
|
||||
/** @var BooleanConstraint */
|
||||
protected $favorite;
|
||||
|
||||
/** @var BooleanConstraint */
|
||||
protected $needsReview;
|
||||
|
||||
/** @var NumberConstraint */
|
||||
protected $mass;
|
||||
|
||||
/** @var DateTimeConstraint */
|
||||
protected $lastModified;
|
||||
|
||||
/** @var DateTimeConstraint */
|
||||
protected $addedDate;
|
||||
|
||||
/** @var EntityConstraint */
|
||||
protected $category;
|
||||
|
||||
/** @var EntityConstraint */
|
||||
protected $footprint;
|
||||
|
||||
/** @var EntityConstraint */
|
||||
protected $manufacturer;
|
||||
|
||||
/** @var ChoiceConstraint */
|
||||
protected $manufacturing_status;
|
||||
|
||||
/** @var EntityConstraint */
|
||||
protected $supplier;
|
||||
|
||||
/** @var IntConstraint */
|
||||
protected $orderdetailsCount;
|
||||
|
||||
/** @var BooleanConstraint */
|
||||
protected $obsolete;
|
||||
|
||||
/** @var EntityConstraint */
|
||||
protected $storelocation;
|
||||
|
||||
/** @var IntConstraint */
|
||||
protected $lotCount;
|
||||
|
||||
/** @var NumberConstraint */
|
||||
protected $amountSum;
|
||||
|
||||
/** @var BooleanConstraint */
|
||||
protected $lotNeedsRefill;
|
||||
|
||||
/** @var TextConstraint */
|
||||
protected $lotDescription;
|
||||
|
||||
/** @var BooleanConstraint */
|
||||
protected $lotUnknownAmount;
|
||||
|
||||
/** @var DateTimeConstraint */
|
||||
protected $lotExpirationDate;
|
||||
|
||||
/** @var EntityConstraint */
|
||||
protected $measurementUnit;
|
||||
|
||||
/** @var TextConstraint */
|
||||
protected $manufacturer_product_url;
|
||||
|
||||
/** @var TextConstraint */
|
||||
protected $manufacturer_product_number;
|
||||
|
||||
/** @var IntConstraint */
|
||||
protected $attachmentsCount;
|
||||
|
||||
/** @var EntityConstraint */
|
||||
protected $attachmentType;
|
||||
|
||||
/** @var TextConstraint */
|
||||
protected $attachmentName;
|
||||
|
||||
protected IntConstraint $dbId;
|
||||
protected TextConstraint $name;
|
||||
protected TextConstraint $description;
|
||||
protected TextConstraint $comment;
|
||||
protected TagsConstraint $tags;
|
||||
protected NumberConstraint $minAmount;
|
||||
protected BooleanConstraint $favorite;
|
||||
protected BooleanConstraint $needsReview;
|
||||
protected NumberConstraint $mass;
|
||||
protected DateTimeConstraint $lastModified;
|
||||
protected DateTimeConstraint $addedDate;
|
||||
protected EntityConstraint $category;
|
||||
protected EntityConstraint $footprint;
|
||||
protected EntityConstraint $manufacturer;
|
||||
protected ChoiceConstraint $manufacturing_status;
|
||||
protected EntityConstraint $supplier;
|
||||
protected IntConstraint $orderdetailsCount;
|
||||
protected BooleanConstraint $obsolete;
|
||||
protected EntityConstraint $storelocation;
|
||||
protected IntConstraint $lotCount;
|
||||
protected IntConstraint $amountSum;
|
||||
protected BooleanConstraint $lotNeedsRefill;
|
||||
protected TextConstraint $lotDescription;
|
||||
protected BooleanConstraint $lotUnknownAmount;
|
||||
protected DateTimeConstraint $lotExpirationDate;
|
||||
protected EntityConstraint $measurementUnit;
|
||||
protected TextConstraint $manufacturer_product_url;
|
||||
protected TextConstraint $manufacturer_product_number;
|
||||
protected IntConstraint $attachmentsCount;
|
||||
protected EntityConstraint $attachmentType;
|
||||
protected TextConstraint $attachmentName;
|
||||
/** @var ArrayCollection<int, ParameterConstraint> */
|
||||
protected $parameters;
|
||||
|
||||
/** @var IntConstraint */
|
||||
protected $parametersCount;
|
||||
protected ArrayCollection $parameters;
|
||||
protected IntConstraint $parametersCount;
|
||||
|
||||
public function __construct(NodesListBuilder $nodesListBuilder)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,43 +9,43 @@ class PartSearchFilter implements FilterInterface
|
|||
{
|
||||
|
||||
/** @var string The string to query for */
|
||||
protected $keyword;
|
||||
protected string $keyword;
|
||||
|
||||
/** @var boolean Whether to use regex for searching */
|
||||
protected $regex = false;
|
||||
protected bool $regex = false;
|
||||
|
||||
/** @var bool Use name field for searching */
|
||||
protected $name = true;
|
||||
protected bool $name = true;
|
||||
|
||||
/** @var bool Use category name for searching */
|
||||
protected $category = true;
|
||||
protected bool $category = true;
|
||||
|
||||
/** @var bool Use description for searching */
|
||||
protected $description = true;
|
||||
protected bool $description = true;
|
||||
|
||||
/** @var bool Use tags for searching */
|
||||
protected $tags = true;
|
||||
protected bool $tags = true;
|
||||
|
||||
/** @var bool Use storelocation name for searching */
|
||||
protected $storelocation = true;
|
||||
protected bool $storelocation = true;
|
||||
|
||||
/** @var bool Use comment field for searching */
|
||||
protected $comment = true;
|
||||
protected bool $comment = true;
|
||||
|
||||
/** @var bool Use ordernr for searching */
|
||||
protected $ordernr = true;
|
||||
protected bool $ordernr = true;
|
||||
|
||||
/** @var bool Use manufacturer product name for searching */
|
||||
protected $mpn = true;
|
||||
protected bool $mpn = true;
|
||||
|
||||
/** @var bool Use supplier name for searching */
|
||||
protected $supplier = false;
|
||||
protected bool $supplier = false;
|
||||
|
||||
/** @var bool Use manufacturer name for searching */
|
||||
protected $manufacturer = false;
|
||||
protected bool $manufacturer = false;
|
||||
|
||||
/** @var bool Use footprint name for searching */
|
||||
protected $footprint = false;
|
||||
protected bool $footprint = false;
|
||||
|
||||
public function __construct(string $query)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue