mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 18:28:49 +02:00
Improved serialized fields
This commit is contained in:
parent
b99e6c9a21
commit
2c67586873
18 changed files with 84 additions and 1 deletions
|
@ -29,6 +29,7 @@ use App\Entity\Contracts\HasMasterAttachmentInterface;
|
|||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
/**
|
||||
* @ORM\MappedSuperclass()
|
||||
|
@ -43,6 +44,7 @@ abstract class AttachmentContainingDBElement extends AbstractNamedDBElement impl
|
|||
* //@ORM\OneToMany(targetEntity="Attachment", mappedBy="element")
|
||||
*
|
||||
* Mapping is done in sub classes like part
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\Base;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use function is_string;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
|
@ -36,18 +37,21 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
|
|||
/**
|
||||
* @var string The address of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $address = '';
|
||||
|
||||
/**
|
||||
* @var string The phone number of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $phone_number = '';
|
||||
|
||||
/**
|
||||
* @var string The fax number of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $fax_number = '';
|
||||
|
||||
|
@ -55,6 +59,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
|
|||
* @var string The email address of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\Email()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $email_address = '';
|
||||
|
||||
|
@ -62,6 +67,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
|
|||
* @var string The website of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\Url()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $website = '';
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\Base;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
/**
|
||||
* Class PartsContainingDBElement.
|
||||
|
@ -31,4 +32,6 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
*/
|
||||
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
|
||||
{
|
||||
/** @Groups({"full"}) */
|
||||
protected $parameters;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
/**
|
||||
* @var string The comment info for this element
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"simple", "extended", "full"})
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $comment = '';
|
||||
|
||||
|
@ -71,6 +71,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
* @var bool If this property is set, this element can not be selected for part properties.
|
||||
* Useful if this element should be used only for grouping, sorting.
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected bool $not_selectable = false;
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ use App\Entity\Base\AbstractNamedDBElement;
|
|||
use Doctrine\ORM\Mapping as ORM;
|
||||
use InvalidArgumentException;
|
||||
use LogicException;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
use function sprintf;
|
||||
|
@ -84,6 +85,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
* @var string The mathematical symbol for this specification. Can be rendered pretty later. Should be short
|
||||
* @Assert\Length(max=20)
|
||||
* @ORM\Column(type="string", nullable=false)
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $symbol = '';
|
||||
|
||||
|
@ -93,6 +95,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
* @Assert\LessThanOrEqual(propertyPath="value_typical", message="parameters.validator.min_lesser_typical")
|
||||
* @Assert\LessThan(propertyPath="value_max", message="parameters.validator.min_lesser_max")
|
||||
* @ORM\Column(type="float", nullable=true)
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected ?float $value_min = null;
|
||||
|
||||
|
@ -100,6 +103,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
* @var float|null the typical value of this property
|
||||
* @Assert\Type({"null", "float"})
|
||||
* @ORM\Column(type="float", nullable=true)
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected ?float $value_typical = null;
|
||||
|
||||
|
@ -108,24 +112,29 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
* @Assert\Type({"float", "null"})
|
||||
* @Assert\GreaterThanOrEqual(propertyPath="value_typical", message="parameters.validator.max_greater_typical")
|
||||
* @ORM\Column(type="float", nullable=true)
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected ?float $value_max = null;
|
||||
|
||||
/**
|
||||
* @var string The unit in which the value values are given (e.g. V)
|
||||
* @ORM\Column(type="string", nullable=false)
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $unit = '';
|
||||
|
||||
/**
|
||||
* @var string a text value for the given property
|
||||
* @ORM\Column(type="string", nullable=false)
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $value_text = '';
|
||||
|
||||
/**
|
||||
* @var string the group this parameter belongs to
|
||||
* @ORM\Column(type="string", nullable=false, name="param_group")
|
||||
* @Groups({"full"})
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $group = '';
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ use App\Entity\Base\AbstractPartsContainingDBElement;
|
|||
use App\Entity\Parameters\CategoryParameter;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
|
@ -56,48 +57,56 @@ class Category extends AbstractPartsContainingDBElement
|
|||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $partname_hint = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $partname_regex = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected bool $disable_footprints = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected bool $disable_manufacturers = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected bool $disable_autodatasheets = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected bool $disable_properties = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $default_description = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $default_comment = '';
|
||||
/**
|
||||
|
@ -105,6 +114,7 @@ class Category extends AbstractPartsContainingDBElement
|
|||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
|
@ -112,6 +122,7 @@ class Category extends AbstractPartsContainingDBElement
|
|||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\CategoryParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected $parameters;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -40,6 +40,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;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
|
@ -72,6 +73,7 @@ class Part extends AttachmentContainingDBElement
|
|||
* @Assert\Valid()
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\PartParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected $parameters;
|
||||
|
||||
|
@ -96,6 +98,7 @@ class Part extends AttachmentContainingDBElement
|
|||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ use App\Entity\Parts\Category;
|
|||
use App\Entity\Parts\Footprint;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
trait BasicPropertyTrait
|
||||
|
@ -33,12 +34,14 @@ trait BasicPropertyTrait
|
|||
/**
|
||||
* @var string A text describing what this part does
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"simple", "extended", "full"})
|
||||
*/
|
||||
protected string $description = '';
|
||||
|
||||
/**
|
||||
* @var string A comment/note related to this part
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected string $comment = '';
|
||||
|
||||
|
@ -51,6 +54,7 @@ trait BasicPropertyTrait
|
|||
/**
|
||||
* @var bool true, if the part is marked as favorite
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected bool $favorite = false;
|
||||
|
||||
|
@ -61,6 +65,7 @@ trait BasicPropertyTrait
|
|||
* @ORM\JoinColumn(name="id_category", referencedColumnName="id", nullable=false)
|
||||
* @Selectable()
|
||||
* @Assert\NotNull(message="validator.select_valid_category")
|
||||
* @Groups({"simple", "extended", "full"})
|
||||
*/
|
||||
protected ?Category $category = null;
|
||||
|
||||
|
@ -69,6 +74,7 @@ trait BasicPropertyTrait
|
|||
* @ORM\ManyToOne(targetEntity="Footprint")
|
||||
* @ORM\JoinColumn(name="id_footprint", referencedColumnName="id")
|
||||
* @Selectable()
|
||||
* @Groups({"simple", "extended", "full"})
|
||||
*/
|
||||
protected ?Footprint $footprint = null;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ use App\Entity\Parts\MeasurementUnit;
|
|||
use App\Entity\Parts\PartLot;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
|
@ -38,6 +39,7 @@ trait InstockTrait
|
|||
* @ORM\OneToMany(targetEntity="PartLot", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
* @ORM\OrderBy({"amount" = "DESC"})
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected $partLots;
|
||||
|
||||
|
@ -46,6 +48,7 @@ trait InstockTrait
|
|||
* Given in the partUnit.
|
||||
* @ORM\Column(type="float")
|
||||
* @Assert\PositiveOrZero()
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected float $minamount = 0;
|
||||
|
||||
|
@ -53,6 +56,7 @@ trait InstockTrait
|
|||
* @var ?MeasurementUnit the unit in which the part's amount is measured
|
||||
* @ORM\ManyToOne(targetEntity="MeasurementUnit")
|
||||
* @ORM\JoinColumn(name="id_part_unit", referencedColumnName="id", nullable=true)
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected ?MeasurementUnit $partUnit = null;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ use App\Entity\Parts\Manufacturer;
|
|||
use App\Entity\Parts\Part;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
|
@ -45,12 +46,14 @@ trait ManufacturerTrait
|
|||
* @var string the url to the part on the manufacturer's homepage
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\Url()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected string $manufacturer_product_url = '';
|
||||
|
||||
/**
|
||||
* @var string The product number used by the manufacturer. If this is set to "", the name field is used.
|
||||
* @ORM\Column(type="string")
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected string $manufacturer_product_number = '';
|
||||
|
||||
|
@ -58,6 +61,7 @@ trait ManufacturerTrait
|
|||
* @var string The production status of this part. Can be one of the specified ones.
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @Assert\Choice({"announced", "active", "nrfnd", "eol", "discontinued", ""})
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected ?string $manufacturing_status = '';
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace App\Entity\Parts\PartTraits;
|
|||
|
||||
use App\Entity\PriceInformations\Orderdetail;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use function count;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
@ -39,6 +40,7 @@ trait OrderTrait
|
|||
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
* @ORM\OrderBy({"supplierpartnr" = "ASC"})
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected $orderdetails;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ use App\Entity\Base\AbstractPartsContainingDBElement;
|
|||
use App\Entity\Parameters\StorelocationParameter;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
|
@ -70,12 +71,14 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected bool $is_full = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected bool $only_single_part = false;
|
||||
|
||||
|
|
|
@ -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 = "";
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
|||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use InvalidArgumentException;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
|
@ -57,6 +58,7 @@ class Project extends AbstractStructuralDBElement
|
|||
/**
|
||||
* @ORM\OneToMany(targetEntity="ProjectBOMEntry", mappedBy="project", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected $bom_entries;
|
||||
|
||||
|
@ -69,6 +71,7 @@ class Project extends AbstractStructuralDBElement
|
|||
* @var string The current status of the project
|
||||
* @ORM\Column(type="string", length=64, nullable=true)
|
||||
* @Assert\Choice({"draft","planning","in_production","finished","archived"})
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected ?string $status = null;
|
||||
|
||||
|
@ -86,6 +89,7 @@ class Project extends AbstractStructuralDBElement
|
|||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, columnDefinition="DEFAULT ''")
|
||||
* @Groups({"simple", "extended", "full"})
|
||||
*/
|
||||
protected string $description = '';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue