mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-21 18:19:08 +02:00
Use imports instead of FQNs
This commit is contained in:
parent
f63b6d7207
commit
5629215ce4
179 changed files with 792 additions and 597 deletions
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts\PartTraits;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Parts\Part;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
@ -36,14 +37,14 @@ trait AdvancedPropertyTrait
|
|||
* @var bool Determines if this part entry needs review (for example, because it is work in progress)
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $needs_review = false;
|
||||
|
||||
/**
|
||||
* @var string a comma separated list of tags, associated with the part
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $tags = '';
|
||||
|
||||
/**
|
||||
|
@ -51,7 +52,7 @@ trait AdvancedPropertyTrait
|
|||
*/
|
||||
#[Assert\PositiveOrZero]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)]
|
||||
#[ORM\Column(type: Types::FLOAT, nullable: true)]
|
||||
protected ?float $mass = null;
|
||||
|
||||
/**
|
||||
|
@ -59,7 +60,7 @@ trait AdvancedPropertyTrait
|
|||
*/
|
||||
#[Assert\Length(max: 100)]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 100, nullable: true, unique: true)]
|
||||
#[ORM\Column(type: Types::STRING, length: 100, nullable: true, unique: true)]
|
||||
protected ?string $ipn = null;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts\PartTraits;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
|
@ -35,27 +36,27 @@ trait BasicPropertyTrait
|
|||
* @var string A text describing what this part does
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $description = '';
|
||||
|
||||
/**
|
||||
* @var string A comment/note related to this part
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: 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: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $visible = true;
|
||||
|
||||
/**
|
||||
* @var bool true, if the part is marked as favorite
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $favorite = false;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts\PartTraits;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\PartLot;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
@ -41,7 +42,7 @@ trait InstockTrait
|
|||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\OneToMany(targetEntity: 'PartLot', mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['amount' => 'DESC'])]
|
||||
protected \Doctrine\Common\Collections\Collection $partLots;
|
||||
protected Collection $partLots;
|
||||
|
||||
/**
|
||||
* @var float The minimum amount of the part that has to be instock, otherwise more is ordered.
|
||||
|
@ -49,7 +50,7 @@ trait InstockTrait
|
|||
*/
|
||||
#[Assert\PositiveOrZero]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
|
||||
#[ORM\Column(type: Types::FLOAT)]
|
||||
protected float $minamount = 0;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts\PartTraits;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
|
@ -48,14 +49,14 @@ trait ManufacturerTrait
|
|||
*/
|
||||
#[Assert\Url]
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: 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.
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $manufacturer_product_number = '';
|
||||
|
||||
/**
|
||||
|
@ -63,7 +64,7 @@ trait ManufacturerTrait
|
|||
*/
|
||||
#[Assert\Choice(['announced', 'active', 'nrfnd', 'eol', 'discontinued', ''])]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
|
||||
protected ?string $manufacturing_status = '';
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts\PartTraits;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\PriceInformations\Orderdetail;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
@ -39,26 +40,26 @@ trait OrderTrait
|
|||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\PriceInformations\Orderdetail::class, mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: Orderdetail::class, mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['supplierpartnr' => 'ASC'])]
|
||||
protected \Doctrine\Common\Collections\Collection $orderdetails;
|
||||
protected Collection $orderdetails;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
#[ORM\Column(type: Types::INTEGER)]
|
||||
protected int $order_quantity = 0;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $manual_order = false;
|
||||
|
||||
/**
|
||||
* @var Orderdetail|null
|
||||
*/
|
||||
#[ORM\OneToOne(targetEntity: \App\Entity\PriceInformations\Orderdetail::class)]
|
||||
#[ORM\OneToOne(targetEntity: Orderdetail::class)]
|
||||
#[ORM\JoinColumn(name: 'order_orderdetails_id')]
|
||||
protected ?Orderdetail $order_orderdetail = null;
|
||||
|
||||
|
|
|
@ -11,15 +11,18 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
trait ProjectTrait
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\Collection<\App\Entity\ProjectSystem\ProjectBOMEntry> $project_bom_entries
|
||||
* @var Collection<ProjectBOMEntry> $project_bom_entries
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\ProjectSystem\ProjectBOMEntry::class, mappedBy: 'part', cascade: ['remove'], orphanRemoval: true)]
|
||||
protected \Doctrine\Common\Collections\Collection $project_bom_entries;
|
||||
/**
|
||||
* @var Collection<ProjectBOMEntry> $project_bom_entries
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: ProjectBOMEntry::class, mappedBy: 'part', cascade: ['remove'], orphanRemoval: true)]
|
||||
protected 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::class, inversedBy: 'build_part')]
|
||||
#[ORM\OneToOne(targetEntity: Project::class, inversedBy: 'build_part')]
|
||||
#[ORM\JoinColumn]
|
||||
protected ?Project $built_project = null;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue