Improved serialized fields

This commit is contained in:
Jan Böhmer 2023-03-12 01:12:35 +01:00
parent b99e6c9a21
commit 2c67586873
18 changed files with 84 additions and 1 deletions

View file

@ -31,6 +31,7 @@ use App\Validator\Constraints\ValidPartLot;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Exception;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
/**
@ -52,12 +53,14 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
/**
* @var string A short description about this lot, shown in table
* @ORM\Column(type="text")
* @Groups({"simple", "extended", "full"})
*/
protected string $description = '';
/**
* @var string a comment stored with this lot
* @ORM\Column(type="text")
* @Groups({"full"})
*/
protected string $comment = '';
@ -65,6 +68,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
* @var ?DateTime Set a time until when the lot must be used.
* Set to null, if the lot can be used indefinitely.
* @ORM\Column(type="datetime", name="expiration_date", nullable=true)
* @Groups({"extended", "full"})
*/
protected ?DateTime $expiration_date = null;
@ -73,12 +77,14 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
* @ORM\ManyToOne(targetEntity="Storelocation")
* @ORM\JoinColumn(name="id_store_location", referencedColumnName="id", nullable=true)
* @Selectable()
* @Groups({"simple", "extended", "full"})
*/
protected ?Storelocation $storage_location = null;
/**
* @var bool If this is set to true, the instock amount is marked as not known
* @ORM\Column(type="boolean")
* @Groups({"simple", "extended", "full"})
*/
protected bool $instock_unknown = false;
@ -86,12 +92,14 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
* @var float For continuous sizes (length, volume, etc.) the instock is saved here.
* @ORM\Column(type="float")
* @Assert\PositiveOrZero()
* @Groups({"simple", "extended", "full"})
*/
protected float $amount = 0.0;
/**
* @var bool determines if this lot was manually marked for refilling
* @ORM\Column(type="boolean")
* @Groups({"extended", "full"})
*/
protected bool $needs_refill = false;