mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-03 15:04:32 +02:00
Applied rector rules up to symfony 6.2
This commit is contained in:
parent
88ea920dfb
commit
a43af180a7
145 changed files with 563 additions and 889 deletions
|
@ -99,9 +99,9 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
/**
|
||||
* @var string the name of this element
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\NotBlank(message="validator.attachment.name_not_blank")
|
||||
* @Groups({"simple", "extended", "full"})
|
||||
*/
|
||||
#[Assert\NotBlank(message: 'validator.attachment.name_not_blank')]
|
||||
#[Groups(['simple', 'extended', 'full'])]
|
||||
protected string $name = '';
|
||||
|
||||
/**
|
||||
|
@ -120,8 +120,8 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
* @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="attachments_with_type")
|
||||
* @ORM\JoinColumn(name="type_id", referencedColumnName="id", nullable=false)
|
||||
* @Selectable()
|
||||
* @Assert\NotNull(message="validator.attachment.must_not_be_null")
|
||||
*/
|
||||
#[Assert\NotNull(message: 'validator.attachment.must_not_be_null')]
|
||||
protected ?AttachmentType $attachment_type = null;
|
||||
|
||||
public function __construct()
|
||||
|
|
|
@ -44,8 +44,8 @@ abstract class AttachmentContainingDBElement extends AbstractNamedDBElement impl
|
|||
* //@ORM\OneToMany(targetEntity="Attachment", mappedBy="element")
|
||||
*
|
||||
* Mapping is done in sub classes like part
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
public function __construct()
|
||||
|
|
|
@ -63,15 +63,15 @@ class AttachmentType extends AbstractStructuralDBElement
|
|||
* @var Collection<int, AttachmentTypeAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\AttachmentTypeAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, AttachmentTypeParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\AttachmentTypeParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,8 +29,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* A attachment attached to an attachmentType element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'attachment_type', 'element'])]
|
||||
class AttachmentTypeAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = AttachmentType::class;
|
||||
|
|
|
@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* An attachment attached to a category element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'attachment_type', 'element'])]
|
||||
class CategoryAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Category::class;
|
||||
|
|
|
@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* An attachment attached to a currency element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'attachment_type', 'element'])]
|
||||
class CurrencyAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Currency::class;
|
||||
|
|
|
@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* An attachment attached to a footprint element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'attachment_type', 'element'])]
|
||||
class FootprintAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Footprint::class;
|
||||
|
|
|
@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* An attachment attached to a Group element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'attachment_type', 'element'])]
|
||||
class GroupAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Group::class;
|
||||
|
|
|
@ -49,8 +49,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* A attachment attached to a user element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'attachment_type', 'element'])]
|
||||
class LabelAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = LabelProfile::class;
|
||||
|
|
|
@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* An attachment attached to a manufacturer element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'attachment_type', 'element'])]
|
||||
class ManufacturerAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Manufacturer::class;
|
||||
|
|
|
@ -31,8 +31,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* An attachment attached to a measurement unit element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'attachment_type', 'element'])]
|
||||
class MeasurementUnitAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class;
|
||||
|
|
|
@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* A attachment attached to a part element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'attachment_type', 'element'])]
|
||||
class PartAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Part::class;
|
||||
|
|
|
@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* A attachment attached to a device element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'attachment_type', 'element'])]
|
||||
class ProjectAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Project::class;
|
||||
|
|
|
@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* An attachment attached to a measurement unit element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'attachment_type', 'element'])]
|
||||
class StorelocationAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Storelocation::class;
|
||||
|
|
|
@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* A attachment attached to a supplier element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'attachment_type', 'element'])]
|
||||
class SupplierAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Supplier::class;
|
||||
|
|
|
@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* An attachment attached to a user element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'attachment_type', 'element'])]
|
||||
class UserAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = User::class;
|
||||
|
|
|
@ -37,38 +37,38 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
|
|||
/**
|
||||
* @var string The address of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
protected string $address = '';
|
||||
|
||||
/**
|
||||
* @var string The phone number of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
protected string $phone_number = '';
|
||||
|
||||
/**
|
||||
* @var string The fax number of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
protected string $fax_number = '';
|
||||
|
||||
/**
|
||||
* @var string The email address of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\Email()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Assert\Email]
|
||||
#[Groups(['full'])]
|
||||
protected string $email_address = '';
|
||||
|
||||
/**
|
||||
* @var string The website of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\Url()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Assert\Url]
|
||||
#[Groups(['full'])]
|
||||
protected string $website = '';
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,41 +36,8 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
* must have the table row "id"!! The ID is the unique key to identify the elements.
|
||||
*
|
||||
* @ORM\MappedSuperclass(repositoryClass="App\Repository\DBElementRepository")
|
||||
*
|
||||
* @DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "attachment_type" = "App\Entity\Attachments\AttachmentType",
|
||||
* "attachment" = "App\Entity\Attachments\Attachment",
|
||||
* "attachment_type_attachment" = "App\Entity\Attachments\AttachmentTypeAttachment",
|
||||
* "category_attachment" = "App\Entity\Attachments\CategoryAttachment",
|
||||
* "currency_attachment" = "App\Entity\Attachments\CurrencyAttachment",
|
||||
* "footprint_attachment" = "App\Entity\Attachments\FootprintAttachment",
|
||||
* "group_attachment" = "App\Entity\Attachments\GroupAttachment",
|
||||
* "label_attachment" = "App\Entity\Attachments\LabelAttachment",
|
||||
* "manufacturer_attachment" = "App\Entity\Attachments\ManufacturerAttachment",
|
||||
* "measurement_unit_attachment" = "App\Entity\Attachments\MeasurementUnitAttachment",
|
||||
* "part_attachment" = "App\Entity\Attachments\PartAttachment",
|
||||
* "project_attachment" = "App\Entity\Attachments\ProjectAttachment",
|
||||
* "storelocation_attachment" = "App\Entity\Attachments\StorelocationAttachment",
|
||||
* "supplier_attachment" = "App\Entity\Attachments\SupplierAttachment",
|
||||
* "user_attachment" = "App\Entity\Attachments\UserAttachment",
|
||||
* "category" = "App\Entity\Parts\Category",
|
||||
* "project" = "App\Entity\ProjectSystem\Project",
|
||||
* "project_bom_entry" = "App\Entity\ProjectSystem\ProjectBOMEntry",
|
||||
* "footprint" = "App\Entity\Parts\Footprint",
|
||||
* "group" = "App\Entity\UserSystem\Group",
|
||||
* "manufacturer" = "App\Entity\Parts\Manufacturer",
|
||||
* "orderdetail" = "App\Entity\PriceInformations\Orderdetail",
|
||||
* "part" = "App\Entity\Parts\Part",
|
||||
* "pricedetail" = "App\Entity\PriceInformation\Pricedetail",
|
||||
* "storelocation" = "App\Entity\Parts\Storelocation",
|
||||
* "part_lot" = "App\Entity\Parts\PartLot",
|
||||
* "currency" = "App\Entity\PriceInformations\Currency",
|
||||
* "measurement_unit" = "App\Entity\Parts\MeasurementUnit",
|
||||
* "parameter" = "App\Entity\Parts\AbstractParameter",
|
||||
* "supplier" = "App\Entity\Parts\Supplier",
|
||||
* "user" = "App\Entity\UserSystem\User"
|
||||
* })
|
||||
*/
|
||||
#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => 'App\Entity\Attachments\AttachmentType', 'attachment' => 'App\Entity\Attachments\Attachment', 'attachment_type_attachment' => 'App\Entity\Attachments\AttachmentTypeAttachment', 'category_attachment' => 'App\Entity\Attachments\CategoryAttachment', 'currency_attachment' => 'App\Entity\Attachments\CurrencyAttachment', 'footprint_attachment' => 'App\Entity\Attachments\FootprintAttachment', 'group_attachment' => 'App\Entity\Attachments\GroupAttachment', 'label_attachment' => 'App\Entity\Attachments\LabelAttachment', 'manufacturer_attachment' => 'App\Entity\Attachments\ManufacturerAttachment', 'measurement_unit_attachment' => 'App\Entity\Attachments\MeasurementUnitAttachment', 'part_attachment' => 'App\Entity\Attachments\PartAttachment', 'project_attachment' => 'App\Entity\Attachments\ProjectAttachment', 'storelocation_attachment' => 'App\Entity\Attachments\StorelocationAttachment', 'supplier_attachment' => 'App\Entity\Attachments\SupplierAttachment', 'user_attachment' => 'App\Entity\Attachments\UserAttachment', 'category' => 'App\Entity\Parts\Category', 'project' => 'App\Entity\ProjectSystem\Project', 'project_bom_entry' => 'App\Entity\ProjectSystem\ProjectBOMEntry', 'footprint' => 'App\Entity\Parts\Footprint', 'group' => 'App\Entity\UserSystem\Group', 'manufacturer' => 'App\Entity\Parts\Manufacturer', 'orderdetail' => 'App\Entity\PriceInformations\Orderdetail', 'part' => 'App\Entity\Parts\Part', 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => 'App\Entity\Parts\Storelocation', 'part_lot' => 'App\Entity\Parts\PartLot', 'currency' => 'App\Entity\PriceInformations\Currency', 'measurement_unit' => 'App\Entity\Parts\MeasurementUnit', 'parameter' => 'App\Entity\Parts\AbstractParameter', 'supplier' => 'App\Entity\Parts\Supplier', 'user' => 'App\Entity\UserSystem\User'])]
|
||||
abstract class AbstractDBElement implements JsonSerializable
|
||||
{
|
||||
/** @var int|null The Identification number for this part. This value is unique for the element in this table.
|
||||
|
@ -78,8 +45,8 @@ abstract class AbstractDBElement implements JsonSerializable
|
|||
* @ORM\Column(type="integer")
|
||||
* @ORM\Id()
|
||||
* @ORM\GeneratedValue()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
protected ?int $id = null;
|
||||
|
||||
public function __clone()
|
||||
|
|
|
@ -41,9 +41,9 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named
|
|||
/**
|
||||
* @var string the name of this element
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\NotBlank()
|
||||
* @Groups({"simple", "extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\NotBlank]
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
protected string $name = '';
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -33,6 +33,6 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
*/
|
||||
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
|
||||
{
|
||||
/** @Groups({"full"}) */
|
||||
#[Groups(['full'])]
|
||||
protected Collection $parameters;
|
||||
}
|
||||
|
|
|
@ -46,9 +46,8 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
* @ORM\MappedSuperclass(repositoryClass="App\Repository\StructuralDBElementRepository")
|
||||
*
|
||||
* @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"})
|
||||
*
|
||||
* @UniqueEntity(fields={"name", "parent"}, ignoreNull=false, message="structural.entity.unique_name")
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'parent'], ignoreNull: false, message: 'structural.entity.unique_name')]
|
||||
abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
||||
{
|
||||
use ParametersTrait;
|
||||
|
@ -63,16 +62,16 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
/**
|
||||
* @var string The comment info for this element
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected string $comment = '';
|
||||
|
||||
/**
|
||||
* @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", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected bool $not_selectable = false;
|
||||
|
||||
/**
|
||||
|
@ -85,15 +84,15 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
* subclasses.
|
||||
*
|
||||
* @var AbstractStructuralDBElement[]|Collection
|
||||
* @Groups({"include_children"})
|
||||
*/
|
||||
#[Groups(['include_children'])]
|
||||
protected Collection $children;
|
||||
|
||||
/**
|
||||
* @var AbstractStructuralDBElement
|
||||
* @NoneOfItsChildren()
|
||||
* @Groups({"include_parents", "import"})
|
||||
*/
|
||||
#[Groups(['include_parents', 'import'])]
|
||||
protected ?AbstractStructuralDBElement $parent = null;
|
||||
|
||||
/** @var string[] all names of all parent elements as an array of strings,
|
||||
|
|
|
@ -35,8 +35,8 @@ trait MasterAttachmentTrait
|
|||
* @var Attachment|null
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment")
|
||||
* @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true)
|
||||
* @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture")
|
||||
*/
|
||||
#[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')]
|
||||
protected ?Attachment $master_picture_attachment = null;
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,15 +34,15 @@ trait TimestampTrait
|
|||
/**
|
||||
* @var DateTime|null the date when this element was modified the last time
|
||||
* @ORM\Column(type="datetime", name="last_modified", options={"default":"CURRENT_TIMESTAMP"})
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
#[Groups(['extended', 'full'])]
|
||||
protected ?DateTime $lastModified = null;
|
||||
|
||||
/**
|
||||
* @var DateTime|null the date when this element was created
|
||||
* @ORM\Column(type="datetime", name="datetime_added", options={"default":"CURRENT_TIMESTAMP"})
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
#[Groups(['extended', 'full'])]
|
||||
protected ?DateTime $addedDate = null;
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,37 +57,37 @@ class LabelOptions
|
|||
|
||||
/**
|
||||
* @var float The page size of the label in mm
|
||||
* @Assert\Positive()
|
||||
* @ORM\Column(type="float")
|
||||
*/
|
||||
#[Assert\Positive]
|
||||
protected float $width = 50.0;
|
||||
|
||||
/**
|
||||
* @var float The page size of the label in mm
|
||||
* @Assert\Positive()
|
||||
* @ORM\Column(type="float")
|
||||
*/
|
||||
#[Assert\Positive]
|
||||
protected float $height = 30.0;
|
||||
|
||||
/**
|
||||
* @var string The type of the barcode that should be used in the label (e.g. 'qr')
|
||||
* @Assert\Choice(choices=LabelOptions::BARCODE_TYPES)
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
#[Assert\Choice(choices: LabelOptions::BARCODE_TYPES)]
|
||||
protected string $barcode_type = 'none';
|
||||
|
||||
/**
|
||||
* @var string What image should be shown along the
|
||||
* @Assert\Choice(choices=LabelOptions::PICTURE_TYPES)
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
#[Assert\Choice(choices: LabelOptions::PICTURE_TYPES)]
|
||||
protected string $picture_type = 'none';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @Assert\Choice(choices=LabelOptions::SUPPORTED_ELEMENTS)
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
#[Assert\Choice(choices: LabelOptions::SUPPORTED_ELEMENTS)]
|
||||
protected string $supported_element = 'part';
|
||||
|
||||
/**
|
||||
|
@ -97,9 +97,9 @@ class LabelOptions
|
|||
protected string $additional_css = '';
|
||||
|
||||
/** @var string The mode that will be used to interpret the lines
|
||||
* @Assert\Choice(choices=LabelOptions::LINES_MODES)
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
#[Assert\Choice(choices: LabelOptions::LINES_MODES)]
|
||||
protected string $lines_mode = 'html';
|
||||
|
||||
/**
|
||||
|
|
|
@ -52,8 +52,8 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* @ORM\Entity(repositoryClass="App\Repository\LabelProfileRepository")
|
||||
* @ORM\Table(name="label_profiles")
|
||||
* @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"})
|
||||
* @UniqueEntity({"name", "options.supported_element"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'options.supported_element'])]
|
||||
class LabelProfile extends AttachmentContainingDBElement
|
||||
{
|
||||
/**
|
||||
|
@ -66,8 +66,8 @@ class LabelProfile extends AttachmentContainingDBElement
|
|||
/**
|
||||
* @var LabelOptions
|
||||
* @ORM\Embedded(class="LabelOptions")
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected LabelOptions $options;
|
||||
|
||||
/**
|
||||
|
|
|
@ -83,59 +83,59 @@ 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"})
|
||||
*/
|
||||
#[Assert\Length(max: 20)]
|
||||
#[Groups(['full'])]
|
||||
protected string $symbol = '';
|
||||
|
||||
/**
|
||||
* @var float|null the guaranteed minimum value of this property
|
||||
* @Assert\Type({"float","null"})
|
||||
* @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"})
|
||||
*/
|
||||
#[Assert\Type(['float', null])]
|
||||
#[Assert\LessThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.min_lesser_typical')]
|
||||
#[Assert\LessThan(propertyPath: 'value_max', message: 'parameters.validator.min_lesser_max')]
|
||||
#[Groups(['full'])]
|
||||
protected ?float $value_min = null;
|
||||
|
||||
/**
|
||||
* @var float|null the typical value of this property
|
||||
* @Assert\Type({"null", "float"})
|
||||
* @ORM\Column(type="float", nullable=true)
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Assert\Type([null, 'float'])]
|
||||
#[Groups(['full'])]
|
||||
protected ?float $value_typical = null;
|
||||
|
||||
/**
|
||||
* @var float|null the maximum value of this property
|
||||
* @Assert\Type({"float", "null"})
|
||||
* @Assert\GreaterThanOrEqual(propertyPath="value_typical", message="parameters.validator.max_greater_typical")
|
||||
* @ORM\Column(type="float", nullable=true)
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Assert\Type(['float', null])]
|
||||
#[Assert\GreaterThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.max_greater_typical')]
|
||||
#[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"})
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
protected string $unit = '';
|
||||
|
||||
/**
|
||||
* @var string a text value for the given property
|
||||
* @ORM\Column(type="string", nullable=false)
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[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"})
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
#[Groups(['full'])]
|
||||
protected string $group = '';
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @UniqueEntity(fields={"name", "group", "element"})
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
class AttachmentTypeParameter extends AbstractParameter
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = AttachmentType::class;
|
||||
|
|
|
@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @UniqueEntity(fields={"name", "group", "element"})
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
class CategoryParameter extends AbstractParameter
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Category::class;
|
||||
|
|
|
@ -50,8 +50,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* An attachment attached to a category element.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @UniqueEntity(fields={"name", "group", "element"})
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
class CurrencyParameter extends AbstractParameter
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Currency::class;
|
||||
|
|
|
@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @UniqueEntity(fields={"name", "group", "element"})
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
class FootprintParameter extends AbstractParameter
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Footprint::class;
|
||||
|
|
|
@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @UniqueEntity(fields={"name", "group", "element"})
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
class GroupParameter extends AbstractParameter
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Group::class;
|
||||
|
|
|
@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @UniqueEntity(fields={"name", "group", "element"})
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
class ManufacturerParameter extends AbstractParameter
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Manufacturer::class;
|
||||
|
|
|
@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @UniqueEntity(fields={"name", "group", "element"})
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
class MeasurementUnitParameter extends AbstractParameter
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class;
|
||||
|
|
|
@ -50,8 +50,8 @@ trait ParametersTrait
|
|||
* Mapping done in subclasses.
|
||||
*
|
||||
* @var Collection<int, AbstractParameter>
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @UniqueEntity(fields={"name", "group", "element"})
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
class PartParameter extends AbstractParameter
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Part::class;
|
||||
|
|
|
@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @UniqueEntity(fields={"name", "group", "element"})
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
class ProjectParameter extends AbstractParameter
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Project::class;
|
||||
|
|
|
@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @UniqueEntity(fields={"name", "group", "element"})
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
class StorelocationParameter extends AbstractParameter
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Storelocation::class;
|
||||
|
|
|
@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @UniqueEntity(fields={"name", "group", "element"})
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
class SupplierParameter extends AbstractParameter
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Supplier::class;
|
||||
|
|
|
@ -58,74 +58,74 @@ class Category extends AbstractPartsContainingDBElement
|
|||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected string $partname_hint = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected string $partname_regex = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected bool $disable_footprints = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected bool $disable_manufacturers = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected bool $disable_autodatasheets = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected bool $disable_properties = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected string $default_description = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected string $default_comment = '';
|
||||
|
||||
/**
|
||||
* @var Collection<int, CategoryAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['full'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, CategoryParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\CategoryParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['full'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
public function getPartnameHint(): string
|
||||
|
|
|
@ -57,8 +57,8 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
* @var Collection<int, FootprintAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\FootprintAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $attachments;
|
||||
|
||||
/**
|
||||
|
@ -71,8 +71,8 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
/** @var Collection<int, FootprintParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\FootprintParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $parameters;
|
||||
|
||||
/****************************************
|
||||
|
|
|
@ -57,14 +57,14 @@ class Manufacturer extends AbstractCompany
|
|||
* @var Collection<int, ManufacturerAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, ManufacturerParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\ManufacturerParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $parameters;
|
||||
}
|
||||
|
|
|
@ -40,34 +40,34 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* @ORM\Index(name="unit_idx_name", columns={"name"}),
|
||||
* @ORM\Index(name="unit_idx_parent_name", columns={"parent_id", "name"}),
|
||||
* })
|
||||
* @UniqueEntity("unit")
|
||||
*/
|
||||
#[UniqueEntity('unit')]
|
||||
class MeasurementUnit extends AbstractPartsContainingDBElement
|
||||
{
|
||||
/**
|
||||
* @var string The unit symbol that should be used for the Unit. This could be something like "", g (for grams)
|
||||
* or m (for meters).
|
||||
* @ORM\Column(type="string", name="unit", nullable=true)
|
||||
* @Assert\Length(max=10)
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\Length(max: 10)]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected ?string $unit = null;
|
||||
|
||||
/**
|
||||
* @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", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected bool $is_integer = false;
|
||||
|
||||
/**
|
||||
* @var bool Determines if the unit can be used with SI Prefixes (kilo, giga, milli, etc.).
|
||||
* 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", "import"})
|
||||
*/
|
||||
#[Assert\Expression('this.isUseSIPrefix() == false or this.getUnit() != null', message: 'validator.measurement_unit.use_si_prefix_needs_unit')]
|
||||
#[Groups(['full', 'import'])]
|
||||
protected bool $use_si_prefix = false;
|
||||
|
||||
/**
|
||||
|
@ -87,15 +87,15 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
* @var Collection<int, MeasurementUnitAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\MeasurementUnitAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, MeasurementUnitParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\MeasurementUnitParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,8 +54,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||
* @ORM\Index(name="parts_idx_name", columns={"name"}),
|
||||
* @ORM\Index(name="parts_idx_ipn", columns={"ipn"}),
|
||||
* })
|
||||
* @UniqueEntity(fields={"ipn"}, message="part.ipn.must_be_unique")
|
||||
*/
|
||||
#[UniqueEntity(fields: ['ipn'], message: 'part.ipn.must_be_unique')]
|
||||
class Part extends AttachmentContainingDBElement
|
||||
{
|
||||
use AdvancedPropertyTrait;
|
||||
|
@ -68,11 +68,11 @@ class Part extends AttachmentContainingDBElement
|
|||
use ProjectTrait;
|
||||
|
||||
/** @var Collection<int, PartParameter>
|
||||
* @Assert\Valid()
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\PartParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['full'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
|
@ -95,9 +95,9 @@ class Part extends AttachmentContainingDBElement
|
|||
* @var Collection<int, PartAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['full'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
/**
|
||||
|
@ -110,8 +110,8 @@ class Part extends AttachmentContainingDBElement
|
|||
* @var Attachment|null
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment")
|
||||
* @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true)
|
||||
* @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture")
|
||||
*/
|
||||
#[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')]
|
||||
protected ?Attachment $master_picture_attachment = null;
|
||||
|
||||
public function __construct()
|
||||
|
@ -150,9 +150,7 @@ class Part extends AttachmentContainingDBElement
|
|||
parent::__clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Assert\Callback
|
||||
*/
|
||||
#[Assert\Callback]
|
||||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
{
|
||||
//Ensure that the part name fullfills the regex of the category
|
||||
|
|
|
@ -55,23 +55,23 @@ 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", "import"})
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
protected string $description = '';
|
||||
|
||||
/**
|
||||
* @var string a comment stored with this lot
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected string $comment = '';
|
||||
|
||||
/**
|
||||
* @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", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected ?DateTime $expiration_date = null;
|
||||
|
||||
/**
|
||||
|
@ -79,38 +79,38 @@ 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", "import"})
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
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", "import"})
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
protected bool $instock_unknown = false;
|
||||
|
||||
/**
|
||||
* @var float For continuous sizes (length, volume, etc.) the instock is saved here.
|
||||
* @ORM\Column(type="float")
|
||||
* @Assert\PositiveOrZero()
|
||||
* @Groups({"simple", "extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\PositiveOrZero]
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
protected float $amount = 0.0;
|
||||
|
||||
/**
|
||||
* @var bool determines if this lot was manually marked for refilling
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected bool $needs_refill = false;
|
||||
|
||||
/**
|
||||
* @var Part The part that is stored in this lot
|
||||
* @ORM\ManyToOne(targetEntity="Part", inversedBy="partLots")
|
||||
* @ORM\JoinColumn(name="id_part", referencedColumnName="id", nullable=false, onDelete="CASCADE")
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
#[Assert\NotNull]
|
||||
protected Part $part;
|
||||
|
||||
/**
|
||||
|
@ -338,9 +338,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Assert\Callback
|
||||
*/
|
||||
#[Assert\Callback]
|
||||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
{
|
||||
//Ensure that the owner is not the anonymous user
|
||||
|
|
|
@ -35,31 +35,31 @@ trait AdvancedPropertyTrait
|
|||
/**
|
||||
* @var bool Determines if this part entry needs review (for example, because it is work in progress)
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected bool $needs_review = false;
|
||||
|
||||
/**
|
||||
* @var string a comma separated list of tags, associated with the part
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected string $tags = '';
|
||||
|
||||
/**
|
||||
* @var float|null how much a single part unit weighs in grams
|
||||
* @ORM\Column(type="float", nullable=true)
|
||||
* @Assert\PositiveOrZero()
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\PositiveOrZero]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected ?float $mass = null;
|
||||
|
||||
/**
|
||||
* @var string|null The internal part number of the part
|
||||
* @ORM\Column(type="string", length=100, nullable=true, unique=true)
|
||||
* @Assert\Length(max="100")
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\Length(max: 100)]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected ?string $ipn = null;
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,15 +34,15 @@ trait BasicPropertyTrait
|
|||
/**
|
||||
* @var string A text describing what this part does
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"simple", "extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
protected string $description = '';
|
||||
|
||||
/**
|
||||
* @var string A comment/note related to this part
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected string $comment = '';
|
||||
|
||||
/**
|
||||
|
@ -54,8 +54,8 @@ trait BasicPropertyTrait
|
|||
/**
|
||||
* @var bool true, if the part is marked as favorite
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected bool $favorite = false;
|
||||
|
||||
/**
|
||||
|
@ -64,9 +64,9 @@ trait BasicPropertyTrait
|
|||
* @ORM\ManyToOne(targetEntity="Category")
|
||||
* @ORM\JoinColumn(name="id_category", referencedColumnName="id", nullable=false)
|
||||
* @Selectable()
|
||||
* @Assert\NotNull(message="validator.select_valid_category")
|
||||
* @Groups({"simple", "extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\NotNull(message: 'validator.select_valid_category')]
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
protected ?Category $category = null;
|
||||
|
||||
/**
|
||||
|
@ -74,8 +74,8 @@ trait BasicPropertyTrait
|
|||
* @ORM\ManyToOne(targetEntity="Footprint")
|
||||
* @ORM\JoinColumn(name="id_footprint", referencedColumnName="id")
|
||||
* @Selectable()
|
||||
* @Groups({"simple", "extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
protected ?Footprint $footprint = null;
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,27 +37,27 @@ trait InstockTrait
|
|||
/**
|
||||
* @var Collection|PartLot[] A list of part lots where this part is stored
|
||||
* @ORM\OneToMany(targetEntity="PartLot", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
* @ORM\OrderBy({"amount" = "DESC"})
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected $partLots;
|
||||
|
||||
/**
|
||||
* @var float The minimum amount of the part that has to be instock, otherwise more is ordered.
|
||||
* Given in the partUnit.
|
||||
* @ORM\Column(type="float")
|
||||
* @Assert\PositiveOrZero()
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\PositiveOrZero]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected float $minamount = 0;
|
||||
|
||||
/**
|
||||
* @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", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected ?MeasurementUnit $partUnit = null;
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,31 +39,31 @@ trait ManufacturerTrait
|
|||
* @ORM\ManyToOne(targetEntity="Manufacturer")
|
||||
* @ORM\JoinColumn(name="id_manufacturer", referencedColumnName="id")
|
||||
* @Selectable()
|
||||
* @Groups({"simple","extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
protected ?Manufacturer $manufacturer = null;
|
||||
|
||||
/**
|
||||
* @var string the url to the part on the manufacturer's homepage
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\Url()
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Assert\Url]
|
||||
#[Groups(['full', 'import'])]
|
||||
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", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected string $manufacturer_product_number = '';
|
||||
|
||||
/**
|
||||
* @var string|null 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", "import"})
|
||||
*/
|
||||
#[Assert\Choice(['announced', 'active', 'nrfnd', 'eol', 'discontinued', ''])]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected ?string $manufacturing_status = '';
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,10 +37,10 @@ trait OrderTrait
|
|||
/**
|
||||
* @var Orderdetail[]|Collection the details about how and where you can order this part
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
* @ORM\OrderBy({"supplierpartnr" = "ASC"})
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected $orderdetails;
|
||||
|
||||
/**
|
||||
|
|
|
@ -66,37 +66,37 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
/** @var Collection<int, StorelocationParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\StorelocationParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected bool $is_full = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected bool $only_single_part = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected bool $limit_to_existing_parts = false;
|
||||
|
||||
/**
|
||||
* @var User|null The owner of this storage location
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User")
|
||||
* @ORM\JoinColumn(name="id_owner", referencedColumnName="id", nullable=true, onDelete="SET NULL")
|
||||
* @Assert\Expression("this.getOwner() == null or this.getOwner().isAnonymousUser() === false", message="validator.part_lot.owner_must_not_be_anonymous")
|
||||
*/
|
||||
#[Assert\Expression('this.getOwner() == null or this.getOwner().isAnonymousUser() === false', message: 'validator.part_lot.owner_must_not_be_anonymous')]
|
||||
protected ?User $owner = null;
|
||||
|
||||
/**
|
||||
|
@ -108,8 +108,8 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
/**
|
||||
* @var Collection<int, StorelocationAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $attachments;
|
||||
|
||||
/********************************************************************************
|
||||
|
|
|
@ -76,24 +76,24 @@ class Supplier extends AbstractCompany
|
|||
/**
|
||||
* @var BigDecimal|null the shipping costs that have to be paid, when ordering via this supplier
|
||||
* @ORM\Column(name="shipping_costs", nullable=true, type="big_decimal", precision=11, scale=5)
|
||||
* @Groups({"extended", "full", "import"})
|
||||
* @BigDecimalPositiveOrZero()
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected ?BigDecimal $shipping_costs = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, SupplierAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\SupplierAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, SupplierParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\SupplierParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,13 +38,13 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
/**
|
||||
* This entity describes a currency that can be used for price information.
|
||||
*
|
||||
* @UniqueEntity("iso_code")
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="currencies", indexes={
|
||||
* @ORM\Index(name="currency_idx_name", columns={"name"}),
|
||||
* @ORM\Index(name="currency_idx_parent_name", columns={"parent_id", "name"}),
|
||||
* })
|
||||
*/
|
||||
#[UniqueEntity('iso_code')]
|
||||
class Currency extends AbstractStructuralDBElement
|
||||
{
|
||||
public const PRICE_SCALE = 5;
|
||||
|
@ -60,9 +60,9 @@ class Currency extends AbstractStructuralDBElement
|
|||
/**
|
||||
* @var string the 3-letter ISO code of the currency
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\Currency()
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\Currency]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected string $iso_code = "";
|
||||
|
||||
/**
|
||||
|
@ -81,15 +81,15 @@ class Currency extends AbstractStructuralDBElement
|
|||
* @var Collection<int, CurrencyAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CurrencyAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, CurrencyParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\CurrencyParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $parameters;
|
||||
|
||||
/** @var Collection<int, Pricedetail>
|
||||
|
|
|
@ -45,57 +45,57 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* })
|
||||
* @ORM\Entity()
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
* @UniqueEntity({"supplierpartnr", "supplier", "part"})
|
||||
*/
|
||||
#[UniqueEntity(['supplierpartnr', 'supplier', 'part'])]
|
||||
class Orderdetail extends AbstractDBElement implements TimeStampableInterface, NamedElementInterface
|
||||
{
|
||||
use TimestampTrait;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Pricedetail", mappedBy="orderdetail", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
* @ORM\OrderBy({"min_discount_quantity" = "ASC"})
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected Collection $pricedetails;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="string")
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected string $supplierpartnr = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected bool $obsolete = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\Url()
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Assert\Url]
|
||||
#[Groups(['full', 'import'])]
|
||||
protected string $supplier_product_url = '';
|
||||
|
||||
/**
|
||||
* @var Part|null
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="orderdetails")
|
||||
* @ORM\JoinColumn(name="part_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
#[Assert\NotNull]
|
||||
protected ?Part $part = null;
|
||||
|
||||
/**
|
||||
* @var Supplier|null
|
||||
* @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", "import"})
|
||||
*/
|
||||
#[Assert\NotNull(message: 'validator.orderdetail.supplier_must_not_be_null')]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected ?Supplier $supplier = null;
|
||||
|
||||
public function __construct()
|
||||
|
|
|
@ -44,8 +44,8 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* @ORM\Index(name="pricedetails_idx_min_discount_price_qty", columns={"min_discount_quantity", "price_related_quantity"}),
|
||||
* })
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
* @UniqueEntity(fields={"min_discount_quantity", "orderdetail"})
|
||||
*/
|
||||
#[UniqueEntity(fields: ['min_discount_quantity', 'orderdetail'])]
|
||||
class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
||||
{
|
||||
use TimestampTrait;
|
||||
|
@ -56,8 +56,8 @@ 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"})
|
||||
*/
|
||||
#[Groups(['extended', 'full'])]
|
||||
protected BigDecimal $price;
|
||||
|
||||
/**
|
||||
|
@ -66,24 +66,24 @@ 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", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected ?Currency $currency = null;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
* @ORM\Column(type="float")
|
||||
* @Assert\Positive()
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\Positive]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected float $price_related_quantity = 1.0;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
* @ORM\Column(type="float")
|
||||
* @Assert\Positive()
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\Positive]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected float $min_discount_quantity = 1.0;
|
||||
|
||||
/**
|
||||
|
@ -96,8 +96,8 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
* @var Orderdetail|null
|
||||
* @ORM\ManyToOne(targetEntity="Orderdetail", inversedBy="pricedetails")
|
||||
* @ORM\JoinColumn(name="orderdetails_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
#[Assert\NotNull]
|
||||
protected ?Orderdetail $orderdetail = null;
|
||||
|
||||
public function __construct()
|
||||
|
|
|
@ -57,9 +57,9 @@ class Project extends AbstractStructuralDBElement
|
|||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="ProjectBOMEntry", mappedBy="project", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['extended', 'full'])]
|
||||
protected Collection $bom_entries;
|
||||
|
||||
/**
|
||||
|
@ -70,9 +70,9 @@ class Project extends AbstractStructuralDBElement
|
|||
/**
|
||||
* @var string|null 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"})
|
||||
*/
|
||||
#[Assert\Choice(['draft', 'planning', 'in_production', 'finished', 'archived'])]
|
||||
#[Groups(['extended', 'full'])]
|
||||
protected ?string $status = null;
|
||||
|
||||
|
||||
|
@ -89,8 +89,8 @@ class Project extends AbstractStructuralDBElement
|
|||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
* @Groups({"simple", "extended", "full"})
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full'])]
|
||||
protected string $description = '';
|
||||
|
||||
/**
|
||||
|
@ -286,9 +286,7 @@ class Project extends AbstractStructuralDBElement
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Assert\Callback
|
||||
*/
|
||||
#[Assert\Callback]
|
||||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
{
|
||||
//If this project has subprojects, and these have builds part, they must be included in the BOM
|
||||
|
|
|
@ -40,9 +40,9 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||
* @ORM\Table("project_bom_entries")
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity(fields={"part", "project"}, message="project.bom_entry.part_already_in_bom")
|
||||
* @UniqueEntity(fields={"name", "project"}, message="project.bom_entry.name_already_in_bom", ignoreNull=true)
|
||||
*/
|
||||
#[UniqueEntity(fields: ['part', 'project'], message: 'project.bom_entry.part_already_in_bom')]
|
||||
#[UniqueEntity(fields: ['name', 'project'], message: 'project.bom_entry.name_already_in_bom', ignoreNull: true)]
|
||||
class ProjectBOMEntry extends AbstractDBElement
|
||||
{
|
||||
use TimestampTrait;
|
||||
|
@ -50,8 +50,8 @@ class ProjectBOMEntry extends AbstractDBElement
|
|||
/**
|
||||
* @var float
|
||||
* @ORM\Column(type="float", name="quantity")
|
||||
* @Assert\Positive()
|
||||
*/
|
||||
#[Assert\Positive]
|
||||
protected float $quantity;
|
||||
|
||||
/**
|
||||
|
@ -63,11 +63,8 @@ class ProjectBOMEntry extends AbstractDBElement
|
|||
/**
|
||||
* @var string|null An optional name describing this BOM entry (useful for non-part entries)
|
||||
* @ORM\Column(type="string", nullable=true)
|
||||
* @Assert\Expression(
|
||||
* "this.getPart() !== null or this.getName() !== null",
|
||||
* message="validator.project.bom_entry.name_or_part_needed"
|
||||
* )
|
||||
*/
|
||||
#[Assert\Expression('this.getPart() !== null or this.getName() !== null', message: 'validator.project.bom_entry.name_or_part_needed')]
|
||||
protected ?string $name = null;
|
||||
|
||||
/**
|
||||
|
@ -93,11 +90,8 @@ class ProjectBOMEntry extends AbstractDBElement
|
|||
/**
|
||||
* @var BigDecimal|null The price of this non-part BOM entry
|
||||
* @ORM\Column(type="big_decimal", precision=11, scale=5, nullable=true)
|
||||
* @Assert\AtLeastOneOf({
|
||||
* @BigDecimalPositive(),
|
||||
* @Assert\IsNull()
|
||||
* })
|
||||
*/
|
||||
#[Assert\AtLeastOneOf([new BigDecimalPositive(), new Assert\IsNull()])]
|
||||
protected ?BigDecimal $price;
|
||||
|
||||
/**
|
||||
|
@ -269,9 +263,7 @@ class ProjectBOMEntry extends AbstractDBElement
|
|||
return $this->part !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Assert\Callback
|
||||
*/
|
||||
#[Assert\Callback]
|
||||
public function validate(ExecutionContextInterface $context, $payload): void
|
||||
{
|
||||
//Round quantity to whole numbers, if the part is not a decimal part
|
||||
|
|
|
@ -66,30 +66,30 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
/**
|
||||
* @var bool If true all users associated with this group must have enabled some kind of two-factor authentication
|
||||
* @ORM\Column(type="boolean", name="enforce_2fa")
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected bool $enforce2FA = false;
|
||||
/**
|
||||
* @var Collection<int, GroupAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\GroupAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $attachments;
|
||||
|
||||
/**
|
||||
* @var PermissionData|null
|
||||
* @ValidPermission()
|
||||
* @ORM\Embedded(class="PermissionData", columnPrefix="permissions_")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
protected ?PermissionData $permissions = null;
|
||||
|
||||
/** @var Collection<int, GroupParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\GroupParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
protected Collection $parameters;
|
||||
|
||||
public function __construct()
|
||||
|
|
|
@ -60,8 +60,8 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface
|
|||
* @ORM\Index(name="user_idx_username", columns={"name"})
|
||||
* })
|
||||
* @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"})
|
||||
* @UniqueEntity("name", message="validator.user.username_already_used")
|
||||
*/
|
||||
#[UniqueEntity('name', message: 'validator.user.username_already_used')]
|
||||
class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface,
|
||||
BackupCodeInterface, TrustedDeviceInterface, WebauthnTwoFactorInterface, PreferredProviderInterface, PasswordAuthenticatedUserInterface, SamlUserInterface
|
||||
{
|
||||
|
@ -75,16 +75,16 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* @var bool Determines if the user is disabled (user can not log in)
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected bool $disabled = false;
|
||||
|
||||
/**
|
||||
* @var string|null The theme
|
||||
* @ORM\Column(type="string", name="config_theme", nullable=true)
|
||||
* @ValidTheme()
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected ?string $theme = null;
|
||||
|
||||
/**
|
||||
|
@ -106,8 +106,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* @var string A self-description of the user
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected string $aboutMe = '';
|
||||
|
||||
/** @var int The version of the trusted device cookie. Used to invalidate all trusted device cookies at once.
|
||||
|
@ -134,8 +134,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
* @ORM\ManyToOne(targetEntity="Group", inversedBy="users")
|
||||
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
|
||||
* @Selectable()
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected ?Group $group = null;
|
||||
|
||||
/**
|
||||
|
@ -147,25 +147,25 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* @var string|null The timezone the user prefers
|
||||
* @ORM\Column(type="string", name="config_timezone", nullable=true)
|
||||
* @Assert\Timezone()
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Assert\Timezone]
|
||||
#[Groups(['full', 'import'])]
|
||||
protected ?string $timezone = '';
|
||||
|
||||
/**
|
||||
* @var string|null The language/locale the user prefers
|
||||
* @ORM\Column(type="string", name="config_language", nullable=true)
|
||||
* @Assert\Language()
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Assert\Language]
|
||||
#[Groups(['full', 'import'])]
|
||||
protected ?string $language = '';
|
||||
|
||||
/**
|
||||
* @var string|null The email address of the user
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @Assert\Email()
|
||||
* @Groups({"simple", "extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\Email]
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
protected ?string $email = '';
|
||||
|
||||
/**
|
||||
|
@ -177,29 +177,29 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* @var string|null The department the user is working
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @Groups({"simple", "extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
protected ?string $department = '';
|
||||
|
||||
/**
|
||||
* @var string|null The last name of the User
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @Groups({"simple", "extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
protected ?string $last_name = '';
|
||||
|
||||
/**
|
||||
* @var string|null The first name of the User
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @Groups({"simple", "extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
protected ?string $first_name = '';
|
||||
|
||||
/**
|
||||
* @var bool True if the user needs to change password after log in
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected bool $need_pw_change = true;
|
||||
|
||||
/**
|
||||
|
@ -210,9 +210,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=180, unique=true)
|
||||
* @Assert\NotBlank
|
||||
* @Assert\Regex("/^[\w\.\+\-\$]+$/", message="user.invalid_username")
|
||||
*/
|
||||
#[Assert\NotBlank]
|
||||
#[Assert\Regex('/^[\w\.\+\-\$]+$/', message: 'user.invalid_username')]
|
||||
protected string $name = '';
|
||||
|
||||
/**
|
||||
|
@ -230,8 +230,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/** @var DateTime|null The time when the backup codes were generated
|
||||
* @ORM\Column(type="datetime", nullable=true)
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
protected ?DateTime $backupCodesGenerationDate = null;
|
||||
|
||||
/** @var Collection<int, LegacyU2FKeyInterface>
|
||||
|
@ -253,16 +253,16 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
* @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency")
|
||||
* @ORM\JoinColumn(name="currency_id", referencedColumnName="id")
|
||||
* @Selectable()
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
protected ?Currency $currency;
|
||||
|
||||
/**
|
||||
* @var PermissionData|null
|
||||
* @ValidPermission()
|
||||
* @ORM\Embedded(class="PermissionData", columnPrefix="permissions_")
|
||||
* @Groups({"simple", "extended", "full", "import"})
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
protected ?PermissionData $permissions = null;
|
||||
|
||||
/**
|
||||
|
@ -274,8 +274,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* @var bool True if the user was created by a SAML provider (and therefore cannot change its password)
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
#[Groups(['extended', 'full'])]
|
||||
protected bool $saml_user = false;
|
||||
|
||||
public function __construct()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue