diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index c2b56d69..8dc01641 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -147,7 +147,7 @@ abstract class Attachment extends AbstractNamedDBElement * @var string|null the original filename the file had, when the user uploaded it */ #[ORM\Column(type: Types::STRING, nullable: true)] - #[Groups(['full', 'attachment:read'])] + #[Groups(['attachment:read', 'import'])] #[Assert\Length(max: 255)] protected ?string $original_filename = null; @@ -161,7 +161,7 @@ abstract class Attachment extends AbstractNamedDBElement * @var string the name of this element */ #[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 = ''; /** @@ -173,14 +173,14 @@ abstract class Attachment extends AbstractNamedDBElement protected ?AttachmentContainingDBElement $element = null; #[ORM\Column(type: Types::BOOLEAN)] - #[Groups(['attachment:read', 'attachment_write'])] + #[Groups(['attachment:read', 'attachment_write', 'full', 'import'])] protected bool $show_in_table = false; #[Assert\NotNull(message: 'validator.attachment.must_not_be_null')] #[ORM\ManyToOne(targetEntity: AttachmentType::class, inversedBy: 'attachments_with_type')] #[ORM\JoinColumn(name: 'type_id', nullable: false)] #[Selectable] - #[Groups(['attachment:read', 'attachment:write'])] + #[Groups(['attachment:read', 'attachment:write', 'import', 'full'])] #[ApiProperty(readableLink: false)] protected ?AttachmentType $attachment_type = null; diff --git a/src/Entity/Attachments/AttachmentContainingDBElement.php b/src/Entity/Attachments/AttachmentContainingDBElement.php index f2dfd3ef..3c863e85 100644 --- a/src/Entity/Attachments/AttachmentContainingDBElement.php +++ b/src/Entity/Attachments/AttachmentContainingDBElement.php @@ -45,7 +45,7 @@ abstract class AttachmentContainingDBElement extends AbstractNamedDBElement impl * @phpstan-var Collection * ORM Mapping is done in subclasses (e.g. Part) */ - #[Groups(['full'])] + #[Groups(['full', 'import'])] protected Collection $attachments; public function __construct() diff --git a/src/Entity/Attachments/AttachmentType.php b/src/Entity/Attachments/AttachmentType.php index fdf42de5..22333c16 100644 --- a/src/Entity/Attachments/AttachmentType.php +++ b/src/Entity/Attachments/AttachmentType.php @@ -103,7 +103,7 @@ class AttachmentType extends AbstractStructuralDBElement */ #[ORM\Column(type: Types::TEXT)] #[ValidFileFilter] - #[Groups(['attachment_type:read', 'attachment_type:write'])] + #[Groups(['attachment_type:read', 'attachment_type:write', 'import', 'extended'])] protected string $filetype_filter = ''; /** @@ -112,12 +112,12 @@ class AttachmentType extends AbstractStructuralDBElement #[Assert\Valid] #[ORM\OneToMany(mappedBy: 'element', targetEntity: AttachmentTypeAttachment::class, cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => Criteria::ASC])] - #[Groups(['attachment_type:read', 'attachment_type:write'])] + #[Groups(['attachment_type:read', 'attachment_type:write', 'import', 'full'])] protected Collection $attachments; #[ORM\ManyToOne(targetEntity: AttachmentTypeAttachment::class)] #[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; /** @var Collection @@ -125,7 +125,7 @@ class AttachmentType extends AbstractStructuralDBElement #[Assert\Valid] #[ORM\OneToMany(mappedBy: 'element', targetEntity: AttachmentTypeParameter::class, cascade: ['persist', 'remove'], orphanRemoval: true)] #[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; /** diff --git a/src/Entity/Base/AbstractCompany.php b/src/Entity/Base/AbstractCompany.php index a8735479..e3d4fd61 100644 --- a/src/Entity/Base/AbstractCompany.php +++ b/src/Entity/Base/AbstractCompany.php @@ -48,7 +48,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement /** * @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)] #[Assert\Length(max: 255)] protected string $address = ''; @@ -56,7 +56,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement /** * @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)] #[Assert\Length(max: 255)] protected string $phone_number = ''; @@ -64,7 +64,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement /** * @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)] #[Assert\Length(max: 255)] protected string $fax_number = ''; @@ -73,7 +73,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement * @var string The email address of the company */ #[Assert\Email] - #[Groups(['full', 'company:read', 'company:write'])] + #[Groups(['full', 'company:read', 'company:write', 'import', 'extended'])] #[ORM\Column(type: Types::STRING)] #[Assert\Length(max: 255)] protected string $email_address = ''; @@ -82,12 +82,12 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement * @var string The website of the company */ #[Assert\Url] - #[Groups(['full', 'company:read', 'company:write'])] + #[Groups(['full', 'company:read', 'company:write', 'import', 'extended'])] #[ORM\Column(type: Types::STRING)] #[Assert\Length(max: 255)] protected string $website = ''; - #[Groups(['company:read', 'company:write'])] + #[Groups(['company:read', 'company:write', 'import', 'full', 'extended'])] protected string $comment = ''; /** @@ -95,6 +95,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement */ #[ORM\Column(type: Types::STRING)] #[Assert\Length(max: 255)] + #[Groups(['full', 'company:read', 'company:write', 'import', 'extended'])] protected string $auto_product_url = ''; /******************************************************************************** diff --git a/src/Entity/Base/AbstractPartsContainingDBElement.php b/src/Entity/Base/AbstractPartsContainingDBElement.php index 6ef09e34..e2209987 100644 --- a/src/Entity/Base/AbstractPartsContainingDBElement.php +++ b/src/Entity/Base/AbstractPartsContainingDBElement.php @@ -38,7 +38,7 @@ use Symfony\Component\Serializer\Annotation\Groups; #[ORM\MappedSuperclass(repositoryClass: AbstractPartsContainingRepository::class)] abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement { - #[Groups(['full'])] + #[Groups(['full', 'import'])] protected Collection $parameters; public function __construct() diff --git a/src/Entity/EDA/EDACategoryInfo.php b/src/Entity/EDA/EDACategoryInfo.php index 47ce5e28..0163dfb3 100644 --- a/src/Entity/EDA/EDACategoryInfo.php +++ b/src/Entity/EDA/EDACategoryInfo.php @@ -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. */ #[Column(type: Types::STRING, nullable: true)] - #[Groups(['full', 'category:read', 'category:write'])] + #[Groups(['full', 'category:read', 'category:write', 'import'])] #[Length(max: 255)] private ?string $reference_prefix = null; /** @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 - #[Groups(['full', 'category:read', 'category:write'])] + #[Groups(['full', 'category:read', 'category:write', 'import'])] private ?bool $visibility = null; /** @var bool|null If this is set to true, then this part will be excluded from the BOM */ #[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; /** @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)] - #[Groups(['full', 'category:read', 'category:write'])] + #[Groups(['full', 'category:read', 'category:write', 'import'])] private ?bool $exclude_from_board = null; /** @var bool|null If this is set to true, then this part will be excluded in the simulation */ #[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; /** @var string|null The KiCAD schematic symbol, which should be used (the path to the library) */ #[Column(type: Types::STRING, nullable: true)] - #[Groups(['full', 'category:read', 'category:write'])] + #[Groups(['full', 'category:read', 'category:write', 'import'])] #[Length(max: 255)] private ?string $kicad_symbol = null; diff --git a/src/Entity/EDA/EDAFootprintInfo.php b/src/Entity/EDA/EDAFootprintInfo.php index b9b7a0e6..9c5ef1c1 100644 --- a/src/Entity/EDA/EDAFootprintInfo.php +++ b/src/Entity/EDA/EDAFootprintInfo.php @@ -34,7 +34,7 @@ class EDAFootprintInfo { /** @var string|null The KiCAD footprint, which should be used (the path to the library) */ #[Column(type: Types::STRING, nullable: true)] - #[Groups(['full', 'footprint:read', 'footprint:write'])] + #[Groups(['full', 'footprint:read', 'footprint:write', 'import'])] #[Length(max: 255)] private ?string $kicad_footprint = null; diff --git a/src/Entity/EDA/EDAPartInfo.php b/src/Entity/EDA/EDAPartInfo.php index 258ef891..b4fc3588 100644 --- a/src/Entity/EDA/EDAPartInfo.php +++ b/src/Entity/EDA/EDAPartInfo.php @@ -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. */ #[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)] 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) */ #[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)] private ?string $value = null; /** @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 - #[Groups(['full', 'eda_info:read', 'eda_info:write'])] + #[Groups(['full', 'eda_info:read', 'eda_info:write', 'import'])] private ?bool $visibility = null; /** @var bool|null If this is set to true, then this part will be excluded from the BOM */ #[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; /** @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)] - #[Groups(['full', 'eda_info:read', 'eda_info:write'])] + #[Groups(['full', 'eda_info:read', 'eda_info:write', 'import'])] private ?bool $exclude_from_board = null; /** @var bool|null If this is set to true, then this part will be excluded in the simulation */ #[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; /** @var string|null The KiCAD schematic symbol, which should be used (the path to the library) */ #[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)] private ?string $kicad_symbol = null; /** @var string|null The KiCAD footprint, which should be used (the path to the library) */ #[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)] private ?string $kicad_footprint = null; diff --git a/src/Entity/LabelSystem/LabelOptions.php b/src/Entity/LabelSystem/LabelOptions.php index d432df80..ee1a5414 100644 --- a/src/Entity/LabelSystem/LabelOptions.php +++ b/src/Entity/LabelSystem/LabelOptions.php @@ -43,6 +43,7 @@ namespace App\Entity\LabelSystem; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; #[ORM\Embeddable] @@ -53,6 +54,7 @@ class LabelOptions */ #[Assert\Positive] #[ORM\Column(type: Types::FLOAT)] + #[Groups(["extended", "full", "import"])] protected float $width = 50.0; /** @@ -60,38 +62,45 @@ class LabelOptions */ #[Assert\Positive] #[ORM\Column(type: Types::FLOAT)] + #[Groups(["extended", "full", "import"])] protected float $height = 30.0; /** * @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)] + #[Groups(["extended", "full", "import"])] protected BarcodeType $barcode_type = BarcodeType::NONE; /** * @var LabelPictureType What image should be shown along the label */ #[ORM\Column(type: Types::STRING, enumType: LabelPictureType::class)] + #[Groups(["extended", "full", "import"])] protected LabelPictureType $picture_type = LabelPictureType::NONE; #[ORM\Column(type: Types::STRING, enumType: LabelSupportedElement::class)] + #[Groups(["extended", "full", "import"])] protected LabelSupportedElement $supported_element = LabelSupportedElement::PART; /** * @var string any additional CSS for the label */ #[ORM\Column(type: Types::TEXT)] + #[Groups([ "full", "import"])] protected string $additional_css = ''; /** @var LabelProcessMode The mode that will be used to interpret the lines */ #[ORM\Column(name: 'lines_mode', type: Types::STRING, enumType: LabelProcessMode::class)] + #[Groups(["extended", "full", "import"])] protected LabelProcessMode $process_mode = LabelProcessMode::PLACEHOLDER; /** * @var string */ #[ORM\Column(type: Types::TEXT)] + #[Groups(["extended", "full", "import"])] protected string $lines = ''; public function getWidth(): float diff --git a/src/Entity/LabelSystem/LabelProfile.php b/src/Entity/LabelSystem/LabelProfile.php index a59d9292..d3616c34 100644 --- a/src/Entity/LabelSystem/LabelProfile.php +++ b/src/Entity/LabelSystem/LabelProfile.php @@ -52,6 +52,7 @@ use App\Entity\Attachments\LabelAttachment; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** @@ -79,6 +80,7 @@ class LabelProfile extends AttachmentContainingDBElement */ #[Assert\Valid] #[ORM\Embedded(class: 'LabelOptions')] + #[Groups(["extended", "full", "import"])] 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 */ #[ORM\Column(type: Types::BOOLEAN)] + #[Groups(["extended", "full", "import"])] protected bool $show_in_dropdown = true; public function __construct() diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index 006ac302..c42682f9 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -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 */ #[Assert\Length(max: 20)] - #[Groups(['full', 'parameter:read', 'parameter:write'])] + #[Groups(['full', 'parameter:read', 'parameter:write', 'import'])] #[ORM\Column(type: Types::STRING)] protected string $symbol = ''; @@ -126,7 +126,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu #[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', 'parameter:read', 'parameter:write'])] + #[Groups(['full', 'parameter:read', 'parameter:write', 'import'])] #[ORM\Column(type: Types::FLOAT, nullable: true)] 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 */ #[Assert\Type([null, 'float'])] - #[Groups(['full', 'parameter:read', 'parameter:write'])] + #[Groups(['full', 'parameter:read', 'parameter:write', 'import'])] #[ORM\Column(type: Types::FLOAT, nullable: true)] protected ?float $value_typical = null; @@ -143,14 +143,14 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu */ #[Assert\Type(['float', null])] #[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)] protected ?float $value_max = null; /** * @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)] #[Assert\Length(max: 50)] protected string $unit = ''; @@ -158,7 +158,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu /** * @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)] #[Assert\Length(max: 255)] protected string $value_text = ''; @@ -166,7 +166,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu /** * @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)] #[Assert\Length(max: 255)] protected string $group = ''; diff --git a/src/Entity/Parts/InfoProviderReference.php b/src/Entity/Parts/InfoProviderReference.php index c6888b2c..bfa62f32 100644 --- a/src/Entity/Parts/InfoProviderReference.php +++ b/src/Entity/Parts/InfoProviderReference.php @@ -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 */ #[Column(type: Types::STRING, nullable: true)] - #[Groups(['provider_reference:read'])] + #[Groups(['provider_reference:read', 'full'])] 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 */ #[Column(type: Types::STRING, nullable: true)] - #[Groups(['provider_reference:read'])] + #[Groups(['provider_reference:read', 'full'])] 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 */ #[Column(type: Types::STRING, nullable: true)] - #[Groups(['provider_reference:read'])] + #[Groups(['provider_reference:read', 'full'])] private ?string $provider_url = 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; /** diff --git a/src/Entity/Parts/MeasurementUnit.php b/src/Entity/Parts/MeasurementUnit.php index 79281e9f..6dd0b9f2 100644 --- a/src/Entity/Parts/MeasurementUnit.php +++ b/src/Entity/Parts/MeasurementUnit.php @@ -99,7 +99,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement * or m (for meters). */ #[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)] 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. * 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)] 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 */ #[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)] protected bool $use_si_prefix = false; diff --git a/src/Entity/Parts/PartTraits/AssociationTrait.php b/src/Entity/Parts/PartTraits/AssociationTrait.php index 402c8a3a..bb80fc5a 100644 --- a/src/Entity/Parts/PartTraits/AssociationTrait.php +++ b/src/Entity/Parts/PartTraits/AssociationTrait.php @@ -38,7 +38,7 @@ trait AssociationTrait #[Valid] #[ORM\OneToMany(mappedBy: 'owner', targetEntity: PartAssociation::class, cascade: ['persist', 'remove'], orphanRemoval: true)] - #[Groups(['part:read', 'part:write'])] + #[Groups(['part:read', 'part:write', 'full'])] protected Collection $associated_parts_as_owner; /** diff --git a/src/Entity/Parts/PartTraits/EDATrait.php b/src/Entity/Parts/PartTraits/EDATrait.php index eafac58a..313552e7 100644 --- a/src/Entity/Parts/PartTraits/EDATrait.php +++ b/src/Entity/Parts/PartTraits/EDATrait.php @@ -32,7 +32,7 @@ trait EDATrait { #[Valid] #[Embedded(class: EDAPartInfo::class)] - #[Groups(['full', 'part:read', 'part:write'])] + #[Groups(['full', 'part:read', 'part:write', 'import'])] protected EDAPartInfo $eda_info; public function getEdaInfo(): EDAPartInfo diff --git a/src/Entity/PriceInformations/Currency.php b/src/Entity/PriceInformations/Currency.php index 8a63046a..ce20caf8 100644 --- a/src/Entity/PriceInformations/Currency.php +++ b/src/Entity/PriceInformations/Currency.php @@ -102,7 +102,7 @@ class Currency extends AbstractStructuralDBElement */ #[ORM\Column(type: 'big_decimal', precision: 11, scale: 5, nullable: true)] #[BigDecimalPositive] - #[Groups(['currency:read', 'currency:write'])] + #[Groups(['currency:read', 'currency:write', 'simple', 'extended', 'full', 'import'])] #[ApiProperty(readableLink: false, writableLink: false)] protected ?BigDecimal $exchange_rate = null; @@ -114,7 +114,7 @@ class Currency extends AbstractStructuralDBElement */ #[Assert\Currency] #[Assert\NotBlank] - #[Groups(['extended', 'full', 'import', 'currency:read', 'currency:write'])] + #[Groups(['simple', 'extended', 'full', 'import', 'currency:read', 'currency:write'])] #[ORM\Column(type: Types::STRING)] protected string $iso_code = ""; diff --git a/src/Entity/ProjectSystem/Project.php b/src/Entity/ProjectSystem/Project.php index 849aa236..1d1ed413 100644 --- a/src/Entity/ProjectSystem/Project.php +++ b/src/Entity/ProjectSystem/Project.php @@ -105,7 +105,7 @@ class Project extends AbstractStructuralDBElement * @var Collection */ #[Assert\Valid] - #[Groups(['extended', 'full'])] + #[Groups(['extended', 'full', 'import'])] #[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.name_already_in_bom', fields: ['name'])] @@ -118,7 +118,7 @@ class Project extends AbstractStructuralDBElement * @var string|null The current status of the project */ #[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)] protected ?string $status = null; diff --git a/src/Entity/ProjectSystem/ProjectBOMEntry.php b/src/Entity/ProjectSystem/ProjectBOMEntry.php index 5b829be0..2a7862ec 100644 --- a/src/Entity/ProjectSystem/ProjectBOMEntry.php +++ b/src/Entity/ProjectSystem/ProjectBOMEntry.php @@ -90,14 +90,14 @@ class ProjectBOMEntry extends AbstractDBElement implements UniqueValidatableInte #[Assert\Positive] #[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; /** * @var string A comma separated list of the names, where this parts should be placed */ #[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 = ''; /** @@ -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')] #[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; /** * @var string An optional comment for this BOM entry */ #[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 = ''; /** @@ -120,7 +120,7 @@ class ProjectBOMEntry extends AbstractDBElement implements UniqueValidatableInte */ #[ORM\ManyToOne(targetEntity: Project::class, inversedBy: 'bom_entries')] #[ORM\JoinColumn(name: 'id_device')] - #[Groups(['bom_entry:read', 'bom_entry:write'])] + #[Groups(['bom_entry:read', 'bom_entry:write', ])] protected ?Project $project = null; /** @@ -128,7 +128,7 @@ class ProjectBOMEntry extends AbstractDBElement implements UniqueValidatableInte */ #[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'project_bom_entries')] #[ORM\JoinColumn(name: 'id_part')] - #[Groups(['bom_entry:read', 'bom_entry:write'])] + #[Groups(['bom_entry:read', 'bom_entry:write', 'full'])] protected ?Part $part = null; /** @@ -136,7 +136,7 @@ class ProjectBOMEntry extends AbstractDBElement implements UniqueValidatableInte */ #[Assert\AtLeastOneOf([new BigDecimalPositive(), new Assert\IsNull()])] #[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; /** diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index cc218eeb..b26a842d 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -144,9 +144,11 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe protected ?string $pw_reset_token = null; #[ORM\Column(name: 'config_instock_comment_a', type: Types::TEXT)] + #[Groups(['extended', 'full', 'import'])] protected string $instock_comment_a = ''; #[ORM\Column(name: 'config_instock_comment_w', type: Types::TEXT)] + #[Groups(['extended', 'full', 'import'])] protected string $instock_comment_w = ''; /**