mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-26 12:59:31 +00:00
Started to move doctrine annotations to attributes (rector automated)
This commit is contained in:
parent
bb1285c35c
commit
0bc4699cdc
73 changed files with 483 additions and 604 deletions
|
|
@ -34,32 +34,32 @@ trait AdvancedPropertyTrait
|
|||
{
|
||||
/**
|
||||
* @var bool Determines if this part entry needs review (for example, because it is work in progress)
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
protected bool $needs_review = false;
|
||||
|
||||
/**
|
||||
* @var string a comma separated list of tags, associated with the part
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
protected string $tags = '';
|
||||
|
||||
/**
|
||||
* @var float|null how much a single part unit weighs in grams
|
||||
* @ORM\Column(type="float", nullable=true)
|
||||
*/
|
||||
#[Assert\PositiveOrZero]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)]
|
||||
protected ?float $mass = null;
|
||||
|
||||
/**
|
||||
* @var string|null The internal part number of the part
|
||||
* @ORM\Column(type="string", length=100, nullable=true, unique=true)
|
||||
*/
|
||||
#[Assert\Length(max: 100)]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 100, nullable: true, unique: true)]
|
||||
protected ?string $ipn = null;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -33,49 +33,49 @@ trait BasicPropertyTrait
|
|||
{
|
||||
/**
|
||||
* @var string A text describing what this part does
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
protected string $description = '';
|
||||
|
||||
/**
|
||||
* @var string A comment/note related to this part
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
protected string $comment = '';
|
||||
|
||||
/**
|
||||
* @var bool Kept for compatibility (it is not used now, and I don't think it was used in old versions)
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
protected bool $visible = true;
|
||||
|
||||
/**
|
||||
* @var bool true, if the part is marked as favorite
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
protected bool $favorite = false;
|
||||
|
||||
/**
|
||||
* @var Category|null The category this part belongs too (e.g. Resistors). Use tags, for more complex grouping.
|
||||
* Every part must have a category.
|
||||
* @ORM\ManyToOne(targetEntity="Category")
|
||||
* @ORM\JoinColumn(name="id_category", referencedColumnName="id", nullable=false)
|
||||
* @Selectable()
|
||||
*/
|
||||
#[Assert\NotNull(message: 'validator.select_valid_category')]
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\ManyToOne(targetEntity: 'Category')]
|
||||
#[ORM\JoinColumn(name: 'id_category', nullable: false)]
|
||||
protected ?Category $category = null;
|
||||
|
||||
/**
|
||||
* @var Footprint|null The footprint of this part (e.g. DIP8)
|
||||
* @ORM\ManyToOne(targetEntity="Footprint")
|
||||
* @ORM\JoinColumn(name="id_footprint", referencedColumnName="id")
|
||||
* @Selectable()
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\ManyToOne(targetEntity: 'Footprint')]
|
||||
#[ORM\JoinColumn(name: 'id_footprint')]
|
||||
protected ?Footprint $footprint = null;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -36,28 +36,28 @@ trait InstockTrait
|
|||
{
|
||||
/**
|
||||
* @var Collection|PartLot[] A list of part lots where this part is stored
|
||||
* @ORM\OneToMany(targetEntity="PartLot", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"amount" = "DESC"})
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected $partLots;
|
||||
#[ORM\OneToMany(targetEntity: 'PartLot', mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['amount' => 'DESC'])]
|
||||
protected \Doctrine\Common\Collections\Collection $partLots;
|
||||
|
||||
/**
|
||||
* @var float The minimum amount of the part that has to be instock, otherwise more is ordered.
|
||||
* Given in the partUnit.
|
||||
* @ORM\Column(type="float")
|
||||
*/
|
||||
#[Assert\PositiveOrZero]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
|
||||
protected float $minamount = 0;
|
||||
|
||||
/**
|
||||
* @var ?MeasurementUnit the unit in which the part's amount is measured
|
||||
* @ORM\ManyToOne(targetEntity="MeasurementUnit")
|
||||
* @ORM\JoinColumn(name="id_part_unit", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\ManyToOne(targetEntity: 'MeasurementUnit')]
|
||||
#[ORM\JoinColumn(name: 'id_part_unit')]
|
||||
protected ?MeasurementUnit $partUnit = null;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -36,34 +36,34 @@ trait ManufacturerTrait
|
|||
{
|
||||
/**
|
||||
* @var Manufacturer|null The manufacturer of this part
|
||||
* @ORM\ManyToOne(targetEntity="Manufacturer")
|
||||
* @ORM\JoinColumn(name="id_manufacturer", referencedColumnName="id")
|
||||
* @Selectable()
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\ManyToOne(targetEntity: 'Manufacturer')]
|
||||
#[ORM\JoinColumn(name: 'id_manufacturer')]
|
||||
protected ?Manufacturer $manufacturer = null;
|
||||
|
||||
/**
|
||||
* @var string the url to the part on the manufacturer's homepage
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
#[Assert\Url]
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
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")
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
protected string $manufacturer_product_number = '';
|
||||
|
||||
/**
|
||||
* @var string|null The production status of this part. Can be one of the specified ones.
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*/
|
||||
#[Assert\Choice(['announced', 'active', 'nrfnd', 'eol', 'discontinued', ''])]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
|
||||
protected ?string $manufacturing_status = '';
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -36,30 +36,30 @@ trait OrderTrait
|
|||
{
|
||||
/**
|
||||
* @var Orderdetail[]|Collection the details about how and where you can order this part
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"supplierpartnr" = "ASC"})
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected $orderdetails;
|
||||
#[ORM\OneToMany(targetEntity: 'App\Entity\PriceInformations\Orderdetail', mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['supplierpartnr' => 'ASC'])]
|
||||
protected \Doctrine\Common\Collections\Collection $orderdetails;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
protected int $order_quantity = 0;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
protected bool $manual_order = false;
|
||||
|
||||
/**
|
||||
* @var Orderdetail|null
|
||||
* @ORM\OneToOne(targetEntity="App\Entity\PriceInformations\Orderdetail")
|
||||
* @ORM\JoinColumn(name="order_orderdetails_id", referencedColumnName="id")
|
||||
*/
|
||||
#[ORM\OneToOne(targetEntity: 'App\Entity\PriceInformations\Orderdetail')]
|
||||
#[ORM\JoinColumn(name: 'order_orderdetails_id')]
|
||||
protected ?Orderdetail $order_orderdetail = null;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -10,16 +10,16 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
trait ProjectTrait
|
||||
{
|
||||
/**
|
||||
* @var Collection<int, ProjectBOMEntry> $project_bom_entries
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\ProjectSystem\ProjectBOMEntry", mappedBy="part", cascade={"remove"}, orphanRemoval=true)
|
||||
* @var \Doctrine\Common\Collections\Collection<\App\Entity\ProjectSystem\ProjectBOMEntry> $project_bom_entries
|
||||
*/
|
||||
protected $project_bom_entries = [];
|
||||
#[ORM\OneToMany(targetEntity: 'App\Entity\ProjectSystem\ProjectBOMEntry', mappedBy: 'part', cascade: ['remove'], orphanRemoval: true)]
|
||||
protected \Doctrine\Common\Collections\Collection $project_bom_entries = [];
|
||||
|
||||
/**
|
||||
* @var Project|null If a project is set here, then this part is special and represents the builds of a project.
|
||||
* @ORM\OneToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="build_part")
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*/
|
||||
#[ORM\OneToOne(targetEntity: 'App\Entity\ProjectSystem\Project', inversedBy: 'build_part')]
|
||||
#[ORM\JoinColumn]
|
||||
protected ?Project $built_project = null;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue