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

@ -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;
/**

View file

@ -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;

View file

@ -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;
/**

View file

@ -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