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

@ -32,6 +32,7 @@ use Doctrine\Common\Collections\ArrayCollection;
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;
/**
@ -60,6 +61,7 @@ class Currency extends AbstractStructuralDBElement
* @var string the 3-letter ISO code of the currency
* @ORM\Column(type="string")
* @Assert\Currency()
* @Groups({"extended", "full"})
*/
protected string $iso_code = "";

View file

@ -34,6 +34,7 @@ use Doctrine\Common\Collections\ArrayCollection;
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;
/**
@ -54,12 +55,14 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
* @ORM\OneToMany(targetEntity="Pricedetail", mappedBy="orderdetail", cascade={"persist", "remove"}, orphanRemoval=true)
* @Assert\Valid()
* @ORM\OrderBy({"min_discount_quantity" = "ASC"})
* @Groups({"extended", "full"})
*/
protected $pricedetails;
/**
* @var string
* @ORM\Column(type="string")
* @Groups({"extended", "full"})
*/
protected string $supplierpartnr = '';
@ -73,6 +76,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
* @var string
* @ORM\Column(type="string")
* @Assert\Url()
* @Groups({"full"})
*/
protected string $supplier_product_url = '';
@ -89,6 +93,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="orderdetails")
* @ORM\JoinColumn(name="id_supplier", referencedColumnName="id")
* @Assert\NotNull(message="validator.orderdetail.supplier_must_not_be_null")
* @Groups({"extended", "full"})
*/
protected ?Supplier $supplier = null;

View file

@ -32,6 +32,7 @@ use Brick\Math\RoundingMode;
use DateTime;
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;
/**
@ -55,6 +56,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
* @var BigDecimal The price related to the detail. (Given in the selected currency)
* @ORM\Column(type="big_decimal", precision=11, scale=5)
* @BigDecimalPositive()
* @Groups({"extended", "full"})
*/
protected BigDecimal $price;
@ -64,6 +66,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
* @ORM\ManyToOne(targetEntity="Currency", inversedBy="pricedetails")
* @ORM\JoinColumn(name="id_currency", referencedColumnName="id", nullable=true)
* @Selectable()
* @Groups({"extended", "full"})
*/
protected ?Currency $currency = null;
@ -71,6 +74,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
* @var float
* @ORM\Column(type="float")
* @Assert\Positive()
* @Groups({"extended", "full"})
*/
protected float $price_related_quantity = 1.0;
@ -78,12 +82,14 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
* @var float
* @ORM\Column(type="float")
* @Assert\Positive()
* @Groups({"extended", "full"})
*/
protected float $min_discount_quantity = 1.0;
/**
* @var bool
* @ORM\Column(type="boolean")
* @Groups({"extended", "full"})
*/
protected bool $manual_input = true;