mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-05 07:54:35 +02:00
Improved serialized fields
This commit is contained in:
parent
b99e6c9a21
commit
2c67586873
18 changed files with 84 additions and 1 deletions
|
@ -28,6 +28,7 @@ use App\Entity\Parameters\MeasurementUnitParameter;
|
|||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
|
@ -48,6 +49,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
* or m (for meters).
|
||||
* @ORM\Column(type="string", name="unit", nullable=true)
|
||||
* @Assert\Length(max=10)
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected ?string $unit = null;
|
||||
|
||||
|
@ -55,6 +57,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
* @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")
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected bool $is_integer = false;
|
||||
|
||||
|
@ -63,6 +66,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
* Useful for sizes like meters. For this the unit must be set
|
||||
* @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")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected bool $use_si_prefix = false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue