Allow to import attachments and parameters via entity import

This fixes issue #363
This commit is contained in:
Jan Böhmer 2024-06-23 00:41:25 +02:00
parent bbf7222a6a
commit 06c8e584a4
19 changed files with 73 additions and 58 deletions

View file

@ -147,7 +147,7 @@ abstract class Attachment extends AbstractNamedDBElement
* @var string|null the original filename the file had, when the user uploaded it * @var string|null the original filename the file had, when the user uploaded it
*/ */
#[ORM\Column(type: Types::STRING, nullable: true)] #[ORM\Column(type: Types::STRING, nullable: true)]
#[Groups(['full', 'attachment:read'])] #[Groups(['attachment:read', 'import'])]
#[Assert\Length(max: 255)] #[Assert\Length(max: 255)]
protected ?string $original_filename = null; protected ?string $original_filename = null;
@ -161,7 +161,7 @@ abstract class Attachment extends AbstractNamedDBElement
* @var string the name of this element * @var string the name of this element
*/ */
#[Assert\NotBlank(message: 'validator.attachment.name_not_blank')] #[Assert\NotBlank(message: 'validator.attachment.name_not_blank')]
#[Groups(['simple', 'extended', 'full', 'attachment:read', 'attachment:write'])] #[Groups(['simple', 'extended', 'full', 'attachment:read', 'attachment:write', 'import'])]
protected string $name = ''; protected string $name = '';
/** /**
@ -173,14 +173,14 @@ abstract class Attachment extends AbstractNamedDBElement
protected ?AttachmentContainingDBElement $element = null; protected ?AttachmentContainingDBElement $element = null;
#[ORM\Column(type: Types::BOOLEAN)] #[ORM\Column(type: Types::BOOLEAN)]
#[Groups(['attachment:read', 'attachment_write'])] #[Groups(['attachment:read', 'attachment_write', 'full', 'import'])]
protected bool $show_in_table = false; protected bool $show_in_table = false;
#[Assert\NotNull(message: 'validator.attachment.must_not_be_null')] #[Assert\NotNull(message: 'validator.attachment.must_not_be_null')]
#[ORM\ManyToOne(targetEntity: AttachmentType::class, inversedBy: 'attachments_with_type')] #[ORM\ManyToOne(targetEntity: AttachmentType::class, inversedBy: 'attachments_with_type')]
#[ORM\JoinColumn(name: 'type_id', nullable: false)] #[ORM\JoinColumn(name: 'type_id', nullable: false)]
#[Selectable] #[Selectable]
#[Groups(['attachment:read', 'attachment:write'])] #[Groups(['attachment:read', 'attachment:write', 'import', 'full'])]
#[ApiProperty(readableLink: false)] #[ApiProperty(readableLink: false)]
protected ?AttachmentType $attachment_type = null; protected ?AttachmentType $attachment_type = null;

View file

@ -45,7 +45,7 @@ abstract class AttachmentContainingDBElement extends AbstractNamedDBElement impl
* @phpstan-var Collection<int, AT> * @phpstan-var Collection<int, AT>
* ORM Mapping is done in subclasses (e.g. Part) * ORM Mapping is done in subclasses (e.g. Part)
*/ */
#[Groups(['full'])] #[Groups(['full', 'import'])]
protected Collection $attachments; protected Collection $attachments;
public function __construct() public function __construct()

View file

@ -103,7 +103,7 @@ class AttachmentType extends AbstractStructuralDBElement
*/ */
#[ORM\Column(type: Types::TEXT)] #[ORM\Column(type: Types::TEXT)]
#[ValidFileFilter] #[ValidFileFilter]
#[Groups(['attachment_type:read', 'attachment_type:write'])] #[Groups(['attachment_type:read', 'attachment_type:write', 'import', 'extended'])]
protected string $filetype_filter = ''; protected string $filetype_filter = '';
/** /**
@ -112,12 +112,12 @@ class AttachmentType extends AbstractStructuralDBElement
#[Assert\Valid] #[Assert\Valid]
#[ORM\OneToMany(mappedBy: 'element', targetEntity: AttachmentTypeAttachment::class, cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OneToMany(mappedBy: 'element', targetEntity: AttachmentTypeAttachment::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => Criteria::ASC])] #[ORM\OrderBy(['name' => Criteria::ASC])]
#[Groups(['attachment_type:read', 'attachment_type:write'])] #[Groups(['attachment_type:read', 'attachment_type:write', 'import', 'full'])]
protected Collection $attachments; protected Collection $attachments;
#[ORM\ManyToOne(targetEntity: AttachmentTypeAttachment::class)] #[ORM\ManyToOne(targetEntity: AttachmentTypeAttachment::class)]
#[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')] #[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')]
#[Groups(['attachment_type:read', 'attachment_type:write'])] #[Groups(['attachment_type:read', 'attachment_type:write', 'full'])]
protected ?Attachment $master_picture_attachment = null; protected ?Attachment $master_picture_attachment = null;
/** @var Collection<int, AttachmentTypeParameter> /** @var Collection<int, AttachmentTypeParameter>
@ -125,7 +125,7 @@ class AttachmentType extends AbstractStructuralDBElement
#[Assert\Valid] #[Assert\Valid]
#[ORM\OneToMany(mappedBy: 'element', targetEntity: AttachmentTypeParameter::class, cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OneToMany(mappedBy: 'element', targetEntity: AttachmentTypeParameter::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => Criteria::ASC, 'name' => 'ASC'])] #[ORM\OrderBy(['group' => Criteria::ASC, 'name' => 'ASC'])]
#[Groups(['attachment_type:read', 'attachment_type:write'])] #[Groups(['attachment_type:read', 'attachment_type:write', 'import', 'full'])]
protected Collection $parameters; protected Collection $parameters;
/** /**

View file

@ -48,7 +48,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
/** /**
* @var string The address of the company * @var string The address of the company
*/ */
#[Groups(['full', 'company:read', 'company:write'])] #[Groups(['full', 'company:read', 'company:write', 'import', 'extended'])]
#[ORM\Column(type: Types::STRING)] #[ORM\Column(type: Types::STRING)]
#[Assert\Length(max: 255)] #[Assert\Length(max: 255)]
protected string $address = ''; protected string $address = '';
@ -56,7 +56,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
/** /**
* @var string The phone number of the company * @var string The phone number of the company
*/ */
#[Groups(['full', 'company:read', 'company:write'])] #[Groups(['full', 'company:read', 'company:write', 'import', 'extended'])]
#[ORM\Column(type: Types::STRING)] #[ORM\Column(type: Types::STRING)]
#[Assert\Length(max: 255)] #[Assert\Length(max: 255)]
protected string $phone_number = ''; protected string $phone_number = '';
@ -64,7 +64,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
/** /**
* @var string The fax number of the company * @var string The fax number of the company
*/ */
#[Groups(['full', 'company:read', 'company:write'])] #[Groups(['full', 'company:read', 'company:write', 'import', 'extended'])]
#[ORM\Column(type: Types::STRING)] #[ORM\Column(type: Types::STRING)]
#[Assert\Length(max: 255)] #[Assert\Length(max: 255)]
protected string $fax_number = ''; protected string $fax_number = '';
@ -73,7 +73,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
* @var string The email address of the company * @var string The email address of the company
*/ */
#[Assert\Email] #[Assert\Email]
#[Groups(['full', 'company:read', 'company:write'])] #[Groups(['full', 'company:read', 'company:write', 'import', 'extended'])]
#[ORM\Column(type: Types::STRING)] #[ORM\Column(type: Types::STRING)]
#[Assert\Length(max: 255)] #[Assert\Length(max: 255)]
protected string $email_address = ''; protected string $email_address = '';
@ -82,12 +82,12 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
* @var string The website of the company * @var string The website of the company
*/ */
#[Assert\Url] #[Assert\Url]
#[Groups(['full', 'company:read', 'company:write'])] #[Groups(['full', 'company:read', 'company:write', 'import', 'extended'])]
#[ORM\Column(type: Types::STRING)] #[ORM\Column(type: Types::STRING)]
#[Assert\Length(max: 255)] #[Assert\Length(max: 255)]
protected string $website = ''; protected string $website = '';
#[Groups(['company:read', 'company:write'])] #[Groups(['company:read', 'company:write', 'import', 'full', 'extended'])]
protected string $comment = ''; protected string $comment = '';
/** /**
@ -95,6 +95,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
*/ */
#[ORM\Column(type: Types::STRING)] #[ORM\Column(type: Types::STRING)]
#[Assert\Length(max: 255)] #[Assert\Length(max: 255)]
#[Groups(['full', 'company:read', 'company:write', 'import', 'extended'])]
protected string $auto_product_url = ''; protected string $auto_product_url = '';
/******************************************************************************** /********************************************************************************

View file

@ -38,7 +38,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\MappedSuperclass(repositoryClass: AbstractPartsContainingRepository::class)] #[ORM\MappedSuperclass(repositoryClass: AbstractPartsContainingRepository::class)]
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
{ {
#[Groups(['full'])] #[Groups(['full', 'import'])]
protected Collection $parameters; protected Collection $parameters;
public function __construct() public function __construct()

View file

@ -36,33 +36,33 @@ class EDACategoryInfo
* @var string|null The reference prefix of the Part in the schematic. E.g. "R" for resistors, or "C" for capacitors. * @var string|null The reference prefix of the Part in the schematic. E.g. "R" for resistors, or "C" for capacitors.
*/ */
#[Column(type: Types::STRING, nullable: true)] #[Column(type: Types::STRING, nullable: true)]
#[Groups(['full', 'category:read', 'category:write'])] #[Groups(['full', 'category:read', 'category:write', 'import'])]
#[Length(max: 255)] #[Length(max: 255)]
private ?string $reference_prefix = null; private ?string $reference_prefix = null;
/** @var bool|null Visibility of this part to EDA software in trinary logic. True=Visible, False=Invisible, Null=Auto */ /** @var bool|null Visibility of this part to EDA software in trinary logic. True=Visible, False=Invisible, Null=Auto */
#[Column(name: 'invisible', type: Types::BOOLEAN, nullable: true)] //TODO: Rename column to visibility #[Column(name: 'invisible', type: Types::BOOLEAN, nullable: true)] //TODO: Rename column to visibility
#[Groups(['full', 'category:read', 'category:write'])] #[Groups(['full', 'category:read', 'category:write', 'import'])]
private ?bool $visibility = null; private ?bool $visibility = null;
/** @var bool|null If this is set to true, then this part will be excluded from the BOM */ /** @var bool|null If this is set to true, then this part will be excluded from the BOM */
#[Column(type: Types::BOOLEAN, nullable: true)] #[Column(type: Types::BOOLEAN, nullable: true)]
#[Groups(['full', 'category:read', 'category:write'])] #[Groups(['full', 'category:read', 'category:write', 'import'])]
private ?bool $exclude_from_bom = null; private ?bool $exclude_from_bom = null;
/** @var bool|null If this is set to true, then this part will be excluded from the board/the PCB */ /** @var bool|null If this is set to true, then this part will be excluded from the board/the PCB */
#[Column(type: Types::BOOLEAN, nullable: true)] #[Column(type: Types::BOOLEAN, nullable: true)]
#[Groups(['full', 'category:read', 'category:write'])] #[Groups(['full', 'category:read', 'category:write', 'import'])]
private ?bool $exclude_from_board = null; private ?bool $exclude_from_board = null;
/** @var bool|null If this is set to true, then this part will be excluded in the simulation */ /** @var bool|null If this is set to true, then this part will be excluded in the simulation */
#[Column(type: Types::BOOLEAN, nullable: true)] #[Column(type: Types::BOOLEAN, nullable: true)]
#[Groups(['full', 'category:read', 'category:write'])] #[Groups(['full', 'category:read', 'category:write', 'import'])]
private ?bool $exclude_from_sim = true; private ?bool $exclude_from_sim = true;
/** @var string|null The KiCAD schematic symbol, which should be used (the path to the library) */ /** @var string|null The KiCAD schematic symbol, which should be used (the path to the library) */
#[Column(type: Types::STRING, nullable: true)] #[Column(type: Types::STRING, nullable: true)]
#[Groups(['full', 'category:read', 'category:write'])] #[Groups(['full', 'category:read', 'category:write', 'import'])]
#[Length(max: 255)] #[Length(max: 255)]
private ?string $kicad_symbol = null; private ?string $kicad_symbol = null;

View file

@ -34,7 +34,7 @@ class EDAFootprintInfo
{ {
/** @var string|null The KiCAD footprint, which should be used (the path to the library) */ /** @var string|null The KiCAD footprint, which should be used (the path to the library) */
#[Column(type: Types::STRING, nullable: true)] #[Column(type: Types::STRING, nullable: true)]
#[Groups(['full', 'footprint:read', 'footprint:write'])] #[Groups(['full', 'footprint:read', 'footprint:write', 'import'])]
#[Length(max: 255)] #[Length(max: 255)]
private ?string $kicad_footprint = null; private ?string $kicad_footprint = null;

View file

@ -36,45 +36,45 @@ class EDAPartInfo
* @var string|null The reference prefix of the Part in the schematic. E.g. "R" for resistors, or "C" for capacitors. * @var string|null The reference prefix of the Part in the schematic. E.g. "R" for resistors, or "C" for capacitors.
*/ */
#[Column(type: Types::STRING, nullable: true)] #[Column(type: Types::STRING, nullable: true)]
#[Groups(['full', 'eda_info:read', 'eda_info:write'])] #[Groups(['full', 'eda_info:read', 'eda_info:write', 'import'])]
#[Length(max: 255)] #[Length(max: 255)]
private ?string $reference_prefix = null; private ?string $reference_prefix = null;
/** @var string|null The value, which should be shown together with the part (e.g. 470 for a 470 Ohm resistor) */ /** @var string|null The value, which should be shown together with the part (e.g. 470 for a 470 Ohm resistor) */
#[Column(type: Types::STRING, nullable: true)] #[Column(type: Types::STRING, nullable: true)]
#[Groups(['full', 'eda_info:read', 'eda_info:write'])] #[Groups(['full', 'eda_info:read', 'eda_info:write', 'import'])]
#[Length(max: 255)] #[Length(max: 255)]
private ?string $value = null; private ?string $value = null;
/** @var bool|null Visibility of this part to EDA software in trinary logic. True=Visible, False=Invisible, Null=Auto */ /** @var bool|null Visibility of this part to EDA software in trinary logic. True=Visible, False=Invisible, Null=Auto */
#[Column(name: 'invisible', type: Types::BOOLEAN, nullable: true)] //TODO: Rename column to visibility #[Column(name: 'invisible', type: Types::BOOLEAN, nullable: true)] //TODO: Rename column to visibility
#[Groups(['full', 'eda_info:read', 'eda_info:write'])] #[Groups(['full', 'eda_info:read', 'eda_info:write', 'import'])]
private ?bool $visibility = null; private ?bool $visibility = null;
/** @var bool|null If this is set to true, then this part will be excluded from the BOM */ /** @var bool|null If this is set to true, then this part will be excluded from the BOM */
#[Column(type: Types::BOOLEAN, nullable: true)] #[Column(type: Types::BOOLEAN, nullable: true)]
#[Groups(['full', 'eda_info:read', 'eda_info:write'])] #[Groups(['full', 'eda_info:read', 'eda_info:write', 'import'])]
private ?bool $exclude_from_bom = null; private ?bool $exclude_from_bom = null;
/** @var bool|null If this is set to true, then this part will be excluded from the board/the PCB */ /** @var bool|null If this is set to true, then this part will be excluded from the board/the PCB */
#[Column(type: Types::BOOLEAN, nullable: true)] #[Column(type: Types::BOOLEAN, nullable: true)]
#[Groups(['full', 'eda_info:read', 'eda_info:write'])] #[Groups(['full', 'eda_info:read', 'eda_info:write', 'import'])]
private ?bool $exclude_from_board = null; private ?bool $exclude_from_board = null;
/** @var bool|null If this is set to true, then this part will be excluded in the simulation */ /** @var bool|null If this is set to true, then this part will be excluded in the simulation */
#[Column(type: Types::BOOLEAN, nullable: true)] #[Column(type: Types::BOOLEAN, nullable: true)]
#[Groups(['full', 'eda_info:read', 'eda_info:write'])] #[Groups(['full', 'eda_info:read', 'eda_info:write', 'import'])]
private ?bool $exclude_from_sim = null; private ?bool $exclude_from_sim = null;
/** @var string|null The KiCAD schematic symbol, which should be used (the path to the library) */ /** @var string|null The KiCAD schematic symbol, which should be used (the path to the library) */
#[Column(type: Types::STRING, nullable: true)] #[Column(type: Types::STRING, nullable: true)]
#[Groups(['full', 'eda_info:read', 'eda_info:write'])] #[Groups(['full', 'eda_info:read', 'eda_info:write', 'import'])]
#[Length(max: 255)] #[Length(max: 255)]
private ?string $kicad_symbol = null; private ?string $kicad_symbol = null;
/** @var string|null The KiCAD footprint, which should be used (the path to the library) */ /** @var string|null The KiCAD footprint, which should be used (the path to the library) */
#[Column(type: Types::STRING, nullable: true)] #[Column(type: Types::STRING, nullable: true)]
#[Groups(['full', 'eda_info:read', 'eda_info:write'])] #[Groups(['full', 'eda_info:read', 'eda_info:write', 'import'])]
#[Length(max: 255)] #[Length(max: 255)]
private ?string $kicad_footprint = null; private ?string $kicad_footprint = null;

View file

@ -43,6 +43,7 @@ namespace App\Entity\LabelSystem;
use Doctrine\DBAL\Types\Types; use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Attribute\Groups;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Embeddable] #[ORM\Embeddable]
@ -53,6 +54,7 @@ class LabelOptions
*/ */
#[Assert\Positive] #[Assert\Positive]
#[ORM\Column(type: Types::FLOAT)] #[ORM\Column(type: Types::FLOAT)]
#[Groups(["extended", "full", "import"])]
protected float $width = 50.0; protected float $width = 50.0;
/** /**
@ -60,38 +62,45 @@ class LabelOptions
*/ */
#[Assert\Positive] #[Assert\Positive]
#[ORM\Column(type: Types::FLOAT)] #[ORM\Column(type: Types::FLOAT)]
#[Groups(["extended", "full", "import"])]
protected float $height = 30.0; protected float $height = 30.0;
/** /**
* @var BarcodeType The type of the barcode that should be used in the label (e.g. 'qr') * @var BarcodeType The type of the barcode that should be used in the label (e.g. 'qr')
*/ */
#[ORM\Column(type: Types::STRING, enumType: BarcodeType::class)] #[ORM\Column(type: Types::STRING, enumType: BarcodeType::class)]
#[Groups(["extended", "full", "import"])]
protected BarcodeType $barcode_type = BarcodeType::NONE; protected BarcodeType $barcode_type = BarcodeType::NONE;
/** /**
* @var LabelPictureType What image should be shown along the label * @var LabelPictureType What image should be shown along the label
*/ */
#[ORM\Column(type: Types::STRING, enumType: LabelPictureType::class)] #[ORM\Column(type: Types::STRING, enumType: LabelPictureType::class)]
#[Groups(["extended", "full", "import"])]
protected LabelPictureType $picture_type = LabelPictureType::NONE; protected LabelPictureType $picture_type = LabelPictureType::NONE;
#[ORM\Column(type: Types::STRING, enumType: LabelSupportedElement::class)] #[ORM\Column(type: Types::STRING, enumType: LabelSupportedElement::class)]
#[Groups(["extended", "full", "import"])]
protected LabelSupportedElement $supported_element = LabelSupportedElement::PART; protected LabelSupportedElement $supported_element = LabelSupportedElement::PART;
/** /**
* @var string any additional CSS for the label * @var string any additional CSS for the label
*/ */
#[ORM\Column(type: Types::TEXT)] #[ORM\Column(type: Types::TEXT)]
#[Groups([ "full", "import"])]
protected string $additional_css = ''; protected string $additional_css = '';
/** @var LabelProcessMode The mode that will be used to interpret the lines /** @var LabelProcessMode The mode that will be used to interpret the lines
*/ */
#[ORM\Column(name: 'lines_mode', type: Types::STRING, enumType: LabelProcessMode::class)] #[ORM\Column(name: 'lines_mode', type: Types::STRING, enumType: LabelProcessMode::class)]
#[Groups(["extended", "full", "import"])]
protected LabelProcessMode $process_mode = LabelProcessMode::PLACEHOLDER; protected LabelProcessMode $process_mode = LabelProcessMode::PLACEHOLDER;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(type: Types::TEXT)] #[ORM\Column(type: Types::TEXT)]
#[Groups(["extended", "full", "import"])]
protected string $lines = ''; protected string $lines = '';
public function getWidth(): float public function getWidth(): float

View file

@ -52,6 +52,7 @@ use App\Entity\Attachments\LabelAttachment;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Attribute\Groups;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/** /**
@ -79,6 +80,7 @@ class LabelProfile extends AttachmentContainingDBElement
*/ */
#[Assert\Valid] #[Assert\Valid]
#[ORM\Embedded(class: 'LabelOptions')] #[ORM\Embedded(class: 'LabelOptions')]
#[Groups(["extended", "full", "import"])]
protected LabelOptions $options; protected LabelOptions $options;
/** /**
@ -91,6 +93,7 @@ class LabelProfile extends AttachmentContainingDBElement
* @var bool determines, if this label profile should be shown in the dropdown quick menu * @var bool determines, if this label profile should be shown in the dropdown quick menu
*/ */
#[ORM\Column(type: Types::BOOLEAN)] #[ORM\Column(type: Types::BOOLEAN)]
#[Groups(["extended", "full", "import"])]
protected bool $show_in_dropdown = true; protected bool $show_in_dropdown = true;
public function __construct() public function __construct()

View file

@ -116,7 +116,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
* @var string The mathematical symbol for this specification. Can be rendered pretty later. Should be short * @var string The mathematical symbol for this specification. Can be rendered pretty later. Should be short
*/ */
#[Assert\Length(max: 20)] #[Assert\Length(max: 20)]
#[Groups(['full', 'parameter:read', 'parameter:write'])] #[Groups(['full', 'parameter:read', 'parameter:write', 'import'])]
#[ORM\Column(type: Types::STRING)] #[ORM\Column(type: Types::STRING)]
protected string $symbol = ''; protected string $symbol = '';
@ -126,7 +126,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
#[Assert\Type(['float', null])] #[Assert\Type(['float', null])]
#[Assert\LessThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.min_lesser_typical')] #[Assert\LessThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.min_lesser_typical')]
#[Assert\LessThan(propertyPath: 'value_max', message: 'parameters.validator.min_lesser_max')] #[Assert\LessThan(propertyPath: 'value_max', message: 'parameters.validator.min_lesser_max')]
#[Groups(['full', 'parameter:read', 'parameter:write'])] #[Groups(['full', 'parameter:read', 'parameter:write', 'import'])]
#[ORM\Column(type: Types::FLOAT, nullable: true)] #[ORM\Column(type: Types::FLOAT, nullable: true)]
protected ?float $value_min = null; protected ?float $value_min = null;
@ -134,7 +134,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
* @var float|null the typical value of this property * @var float|null the typical value of this property
*/ */
#[Assert\Type([null, 'float'])] #[Assert\Type([null, 'float'])]
#[Groups(['full', 'parameter:read', 'parameter:write'])] #[Groups(['full', 'parameter:read', 'parameter:write', 'import'])]
#[ORM\Column(type: Types::FLOAT, nullable: true)] #[ORM\Column(type: Types::FLOAT, nullable: true)]
protected ?float $value_typical = null; protected ?float $value_typical = null;
@ -143,14 +143,14 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
*/ */
#[Assert\Type(['float', null])] #[Assert\Type(['float', null])]
#[Assert\GreaterThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.max_greater_typical')] #[Assert\GreaterThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.max_greater_typical')]
#[Groups(['full', 'parameter:read', 'parameter:write'])] #[Groups(['full', 'parameter:read', 'parameter:write', 'import'])]
#[ORM\Column(type: Types::FLOAT, nullable: true)] #[ORM\Column(type: Types::FLOAT, nullable: true)]
protected ?float $value_max = null; protected ?float $value_max = null;
/** /**
* @var string The unit in which the value values are given (e.g. V) * @var string The unit in which the value values are given (e.g. V)
*/ */
#[Groups(['full', 'parameter:read', 'parameter:write'])] #[Groups(['full', 'parameter:read', 'parameter:write', 'import'])]
#[ORM\Column(type: Types::STRING)] #[ORM\Column(type: Types::STRING)]
#[Assert\Length(max: 50)] #[Assert\Length(max: 50)]
protected string $unit = ''; protected string $unit = '';
@ -158,7 +158,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
/** /**
* @var string a text value for the given property * @var string a text value for the given property
*/ */
#[Groups(['full', 'parameter:read', 'parameter:write'])] #[Groups(['full', 'parameter:read', 'parameter:write', 'import'])]
#[ORM\Column(type: Types::STRING)] #[ORM\Column(type: Types::STRING)]
#[Assert\Length(max: 255)] #[Assert\Length(max: 255)]
protected string $value_text = ''; protected string $value_text = '';
@ -166,7 +166,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
/** /**
* @var string the group this parameter belongs to * @var string the group this parameter belongs to
*/ */
#[Groups(['full', 'parameter:read', 'parameter:write'])] #[Groups(['full', 'parameter:read', 'parameter:write', 'import'])]
#[ORM\Column(name: 'param_group', type: Types::STRING)] #[ORM\Column(name: 'param_group', type: Types::STRING)]
#[Assert\Length(max: 255)] #[Assert\Length(max: 255)]
protected string $group = ''; protected string $group = '';

View file

@ -39,23 +39,23 @@ class InfoProviderReference
/** @var string|null The key referencing the provider used to get this part, or null if it was not provided by a data provider */ /** @var string|null The key referencing the provider used to get this part, or null if it was not provided by a data provider */
#[Column(type: Types::STRING, nullable: true)] #[Column(type: Types::STRING, nullable: true)]
#[Groups(['provider_reference:read'])] #[Groups(['provider_reference:read', 'full'])]
private ?string $provider_key = null; private ?string $provider_key = null;
/** @var string|null The id of this part inside the provider system or null if the part was not provided by a data provider */ /** @var string|null The id of this part inside the provider system or null if the part was not provided by a data provider */
#[Column(type: Types::STRING, nullable: true)] #[Column(type: Types::STRING, nullable: true)]
#[Groups(['provider_reference:read'])] #[Groups(['provider_reference:read', 'full'])]
private ?string $provider_id = null; private ?string $provider_id = null;
/** /**
* @var string|null The url of this part inside the provider system or null if this info is not existing * @var string|null The url of this part inside the provider system or null if this info is not existing
*/ */
#[Column(type: Types::STRING, nullable: true)] #[Column(type: Types::STRING, nullable: true)]
#[Groups(['provider_reference:read'])] #[Groups(['provider_reference:read', 'full'])]
private ?string $provider_url = null; private ?string $provider_url = null;
#[Column(type: Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])] #[Column(type: Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])]
#[Groups(['provider_reference:read'])] #[Groups(['provider_reference:read', 'full'])]
private ?\DateTimeImmutable $last_updated = null; private ?\DateTimeImmutable $last_updated = null;
/** /**

View file

@ -99,7 +99,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
* or m (for meters). * or m (for meters).
*/ */
#[Assert\Length(max: 10)] #[Assert\Length(max: 10)]
#[Groups(['extended', 'full', 'import', 'measurement_unit:read', 'measurement_unit:write'])] #[Groups(['simple', 'extended', 'full', 'import', 'measurement_unit:read', 'measurement_unit:write'])]
#[ORM\Column(name: 'unit', type: Types::STRING, nullable: true)] #[ORM\Column(name: 'unit', type: Types::STRING, nullable: true)]
protected ?string $unit = null; protected ?string $unit = null;
@ -110,7 +110,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
* @var bool Determines if the amount value associated with this unit should be treated as integer. * @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. * Set to false, to measure continuous sizes likes masses or lengths.
*/ */
#[Groups(['extended', 'full', 'import', 'measurement_unit:read', 'measurement_unit:write'])] #[Groups(['simple', 'extended', 'full', 'import', 'measurement_unit:read', 'measurement_unit:write'])]
#[ORM\Column(name: 'is_integer', type: Types::BOOLEAN)] #[ORM\Column(name: 'is_integer', type: Types::BOOLEAN)]
protected bool $is_integer = false; protected bool $is_integer = false;
@ -119,7 +119,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
* Useful for sizes like meters. For this the unit must be set * Useful for sizes like meters. For this the unit must be set
*/ */
#[Assert\Expression('this.isUseSIPrefix() == false or this.getUnit() != null', message: 'validator.measurement_unit.use_si_prefix_needs_unit')] #[Assert\Expression('this.isUseSIPrefix() == false or this.getUnit() != null', message: 'validator.measurement_unit.use_si_prefix_needs_unit')]
#[Groups(['full', 'import', 'measurement_unit:read', 'measurement_unit:write'])] #[Groups(['simple', 'full', 'import', 'measurement_unit:read', 'measurement_unit:write'])]
#[ORM\Column(name: 'use_si_prefix', type: Types::BOOLEAN)] #[ORM\Column(name: 'use_si_prefix', type: Types::BOOLEAN)]
protected bool $use_si_prefix = false; protected bool $use_si_prefix = false;

View file

@ -38,7 +38,7 @@ trait AssociationTrait
#[Valid] #[Valid]
#[ORM\OneToMany(mappedBy: 'owner', targetEntity: PartAssociation::class, #[ORM\OneToMany(mappedBy: 'owner', targetEntity: PartAssociation::class,
cascade: ['persist', 'remove'], orphanRemoval: true)] cascade: ['persist', 'remove'], orphanRemoval: true)]
#[Groups(['part:read', 'part:write'])] #[Groups(['part:read', 'part:write', 'full'])]
protected Collection $associated_parts_as_owner; protected Collection $associated_parts_as_owner;
/** /**

View file

@ -32,7 +32,7 @@ trait EDATrait
{ {
#[Valid] #[Valid]
#[Embedded(class: EDAPartInfo::class)] #[Embedded(class: EDAPartInfo::class)]
#[Groups(['full', 'part:read', 'part:write'])] #[Groups(['full', 'part:read', 'part:write', 'import'])]
protected EDAPartInfo $eda_info; protected EDAPartInfo $eda_info;
public function getEdaInfo(): EDAPartInfo public function getEdaInfo(): EDAPartInfo

View file

@ -102,7 +102,7 @@ class Currency extends AbstractStructuralDBElement
*/ */
#[ORM\Column(type: 'big_decimal', precision: 11, scale: 5, nullable: true)] #[ORM\Column(type: 'big_decimal', precision: 11, scale: 5, nullable: true)]
#[BigDecimalPositive] #[BigDecimalPositive]
#[Groups(['currency:read', 'currency:write'])] #[Groups(['currency:read', 'currency:write', 'simple', 'extended', 'full', 'import'])]
#[ApiProperty(readableLink: false, writableLink: false)] #[ApiProperty(readableLink: false, writableLink: false)]
protected ?BigDecimal $exchange_rate = null; protected ?BigDecimal $exchange_rate = null;
@ -114,7 +114,7 @@ class Currency extends AbstractStructuralDBElement
*/ */
#[Assert\Currency] #[Assert\Currency]
#[Assert\NotBlank] #[Assert\NotBlank]
#[Groups(['extended', 'full', 'import', 'currency:read', 'currency:write'])] #[Groups(['simple', 'extended', 'full', 'import', 'currency:read', 'currency:write'])]
#[ORM\Column(type: Types::STRING)] #[ORM\Column(type: Types::STRING)]
protected string $iso_code = ""; protected string $iso_code = "";

View file

@ -105,7 +105,7 @@ class Project extends AbstractStructuralDBElement
* @var Collection<int, ProjectBOMEntry> * @var Collection<int, ProjectBOMEntry>
*/ */
#[Assert\Valid] #[Assert\Valid]
#[Groups(['extended', 'full'])] #[Groups(['extended', 'full', 'import'])]
#[ORM\OneToMany(mappedBy: 'project', targetEntity: ProjectBOMEntry::class, cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OneToMany(mappedBy: 'project', targetEntity: ProjectBOMEntry::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
#[UniqueObjectCollection(message: 'project.bom_entry.part_already_in_bom', fields: ['part'])] #[UniqueObjectCollection(message: 'project.bom_entry.part_already_in_bom', fields: ['part'])]
#[UniqueObjectCollection(message: 'project.bom_entry.name_already_in_bom', fields: ['name'])] #[UniqueObjectCollection(message: 'project.bom_entry.name_already_in_bom', fields: ['name'])]
@ -118,7 +118,7 @@ class Project extends AbstractStructuralDBElement
* @var string|null The current status of the project * @var string|null The current status of the project
*/ */
#[Assert\Choice(['draft', 'planning', 'in_production', 'finished', 'archived'])] #[Assert\Choice(['draft', 'planning', 'in_production', 'finished', 'archived'])]
#[Groups(['extended', 'full', 'project:read', 'project:write'])] #[Groups(['extended', 'full', 'project:read', 'project:write', 'import'])]
#[ORM\Column(type: Types::STRING, length: 64, nullable: true)] #[ORM\Column(type: Types::STRING, length: 64, nullable: true)]
protected ?string $status = null; protected ?string $status = null;

View file

@ -90,14 +90,14 @@ class ProjectBOMEntry extends AbstractDBElement implements UniqueValidatableInte
#[Assert\Positive] #[Assert\Positive]
#[ORM\Column(name: 'quantity', type: Types::FLOAT)] #[ORM\Column(name: 'quantity', type: Types::FLOAT)]
#[Groups(['bom_entry:read', 'bom_entry:write'])] #[Groups(['bom_entry:read', 'bom_entry:write', 'import', 'simple', 'extended', 'full'])]
protected float $quantity = 1.0; protected float $quantity = 1.0;
/** /**
* @var string A comma separated list of the names, where this parts should be placed * @var string A comma separated list of the names, where this parts should be placed
*/ */
#[ORM\Column(name: 'mountnames', type: Types::TEXT)] #[ORM\Column(name: 'mountnames', type: Types::TEXT)]
#[Groups(['bom_entry:read', 'bom_entry:write'])] #[Groups(['bom_entry:read', 'bom_entry:write', 'import', 'simple', 'extended', 'full'])]
protected string $mountnames = ''; protected string $mountnames = '';
/** /**
@ -105,14 +105,14 @@ class ProjectBOMEntry extends AbstractDBElement implements UniqueValidatableInte
*/ */
#[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')]
#[ORM\Column(type: Types::STRING, nullable: true)] #[ORM\Column(type: Types::STRING, nullable: true)]
#[Groups(['bom_entry:read', 'bom_entry:write'])] #[Groups(['bom_entry:read', 'bom_entry:write', 'import', 'simple', 'extended', 'full'])]
protected ?string $name = null; protected ?string $name = null;
/** /**
* @var string An optional comment for this BOM entry * @var string An optional comment for this BOM entry
*/ */
#[ORM\Column(type: Types::TEXT)] #[ORM\Column(type: Types::TEXT)]
#[Groups(['bom_entry:read', 'bom_entry:write'])] #[Groups(['bom_entry:read', 'bom_entry:write', 'import', 'extended', 'full'])]
protected string $comment = ''; protected string $comment = '';
/** /**
@ -120,7 +120,7 @@ class ProjectBOMEntry extends AbstractDBElement implements UniqueValidatableInte
*/ */
#[ORM\ManyToOne(targetEntity: Project::class, inversedBy: 'bom_entries')] #[ORM\ManyToOne(targetEntity: Project::class, inversedBy: 'bom_entries')]
#[ORM\JoinColumn(name: 'id_device')] #[ORM\JoinColumn(name: 'id_device')]
#[Groups(['bom_entry:read', 'bom_entry:write'])] #[Groups(['bom_entry:read', 'bom_entry:write', ])]
protected ?Project $project = null; protected ?Project $project = null;
/** /**
@ -128,7 +128,7 @@ class ProjectBOMEntry extends AbstractDBElement implements UniqueValidatableInte
*/ */
#[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'project_bom_entries')] #[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'project_bom_entries')]
#[ORM\JoinColumn(name: 'id_part')] #[ORM\JoinColumn(name: 'id_part')]
#[Groups(['bom_entry:read', 'bom_entry:write'])] #[Groups(['bom_entry:read', 'bom_entry:write', 'full'])]
protected ?Part $part = null; protected ?Part $part = null;
/** /**
@ -136,7 +136,7 @@ class ProjectBOMEntry extends AbstractDBElement implements UniqueValidatableInte
*/ */
#[Assert\AtLeastOneOf([new BigDecimalPositive(), new Assert\IsNull()])] #[Assert\AtLeastOneOf([new BigDecimalPositive(), new Assert\IsNull()])]
#[ORM\Column(type: 'big_decimal', precision: 11, scale: 5, nullable: true)] #[ORM\Column(type: 'big_decimal', precision: 11, scale: 5, nullable: true)]
#[Groups(['bom_entry:read', 'bom_entry:write'])] #[Groups(['bom_entry:read', 'bom_entry:write', 'import', 'extended', 'full'])]
protected ?BigDecimal $price = null; protected ?BigDecimal $price = null;
/** /**

View file

@ -144,9 +144,11 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
protected ?string $pw_reset_token = null; protected ?string $pw_reset_token = null;
#[ORM\Column(name: 'config_instock_comment_a', type: Types::TEXT)] #[ORM\Column(name: 'config_instock_comment_a', type: Types::TEXT)]
#[Groups(['extended', 'full', 'import'])]
protected string $instock_comment_a = ''; protected string $instock_comment_a = '';
#[ORM\Column(name: 'config_instock_comment_w', type: Types::TEXT)] #[ORM\Column(name: 'config_instock_comment_w', type: Types::TEXT)]
#[Groups(['extended', 'full', 'import'])]
protected string $instock_comment_w = ''; protected string $instock_comment_w = '';
/** /**