mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 10:24:31 +02:00
Save element parameters in its own database table (dont use JSON)
This makes it easier to query for specific parameters.
This commit is contained in:
parent
a6e0f1738b
commit
719e21c0df
35 changed files with 738 additions and 183 deletions
|
@ -24,8 +24,11 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\CategoryAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Parameters\CategoryParameter;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* Class AttachmentType.
|
||||
|
@ -101,9 +104,16 @@ class Category extends AbstractPartsContainingDBElement
|
|||
/**
|
||||
* @var Collection|CategoryAttachment[]
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var CategoryParameter[]
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\CategoryParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
|
||||
/**
|
||||
* Returns the ID as an string, defined by the element class.
|
||||
* This should have a form like P000014, for a part with ID 14.
|
||||
|
|
|
@ -52,8 +52,11 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\FootprintAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\FootprintParameter;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* Class Footprint.
|
||||
|
@ -81,6 +84,7 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
/**
|
||||
* @var Collection|FootprintAttachment[]
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\FootprintAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
|
@ -91,6 +95,12 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $footprint_3d;
|
||||
|
||||
/** @var FootprintParameter[]
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\FootprintParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
|
||||
/**
|
||||
* Returns the ID as an string, defined by the element class.
|
||||
* This should have a form like P000014, for a part with ID 14.
|
||||
|
|
|
@ -52,8 +52,11 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\ManufacturerAttachment;
|
||||
use App\Entity\Base\AbstractCompany;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\ManufacturerParameter;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* Class Manufacturer.
|
||||
|
@ -81,9 +84,16 @@ class Manufacturer extends AbstractCompany
|
|||
/**
|
||||
* @var Collection|ManufacturerAttachment[]
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var ManufacturerParameter[]
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\ManufacturerParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
|
||||
/**
|
||||
* Returns the ID as an string, defined by the element class.
|
||||
* This should have a form like P000014, for a part with ID 14.
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\MeasurementUnitAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\MeasurementUnitParameter;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
@ -99,9 +101,16 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
/**
|
||||
* @var Collection|MeasurementUnitAttachment[]
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\MeasurementUnitAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var MeasurementUnitParameter[]
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\MeasurementUnitParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
|
||||
/**
|
||||
* Returns the ID as an string, defined by the element class.
|
||||
* This should have a form like P000014, for a part with ID 14.
|
||||
|
|
|
@ -52,8 +52,10 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||
use App\Entity\Base\SpecificationsTrait;
|
||||
use App\Entity\Parameters\ParametersTrait;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\PartParameter;
|
||||
use App\Entity\Parts\PartTraits\AdvancedPropertyTrait;
|
||||
use App\Entity\Parts\PartTraits\BasicPropertyTrait;
|
||||
use App\Entity\Parts\PartTraits\InstockTrait;
|
||||
|
@ -82,13 +84,19 @@ class Part extends AttachmentContainingDBElement
|
|||
use InstockTrait;
|
||||
use ManufacturerTrait;
|
||||
use OrderTrait;
|
||||
use SpecificationsTrait;
|
||||
use ParametersTrait;
|
||||
|
||||
/**
|
||||
* TODO.
|
||||
*/
|
||||
protected $devices = [];
|
||||
|
||||
/** @var PartParameter[]
|
||||
* @Assert\Valid()
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\PartParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
*/
|
||||
protected $parameters;
|
||||
|
||||
/**
|
||||
* @ColumnSecurity(type="datetime")
|
||||
* @ORM\Column(type="datetime", name="datetime_added", options={"default"="CURRENT_TIMESTAMP"})
|
||||
|
@ -134,6 +142,7 @@ class Part extends AttachmentContainingDBElement
|
|||
parent::__construct();
|
||||
$this->partLots = new ArrayCollection();
|
||||
$this->orderdetails = new ArrayCollection();
|
||||
$this->parameters = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -52,8 +52,11 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\StorelocationAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\StorelocationParameter;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* Class Store location.
|
||||
|
@ -85,11 +88,17 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
* @ORM\ManyToMany(targetEntity="Part", fetch="EXTRA_LAZY")
|
||||
* @ORM\JoinTable(name="part_lots",
|
||||
* joinColumns={@ORM\JoinColumn(name="id_store_location", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="id_part", referencedColumnName="id")}
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="id_part", referencedColumnName="id")}
|
||||
* )
|
||||
*/
|
||||
protected $parts;
|
||||
|
||||
/** @var StorelocationParameter[]
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\StorelocationParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
|
@ -110,6 +119,7 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
/**
|
||||
* @var Collection|StorelocationAttachment[]
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\SupplierAttachment;
|
||||
use App\Entity\Base\AbstractCompany;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\SupplierParameter;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
@ -109,9 +111,16 @@ class Supplier extends AbstractCompany
|
|||
/**
|
||||
* @var Collection|SupplierAttachment[]
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\SupplierAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var SupplierParameter[]
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\SupplierParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
|
||||
/**
|
||||
* Gets the currency that should be used by default, when creating a orderdetail with this supplier.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue