Add configurable KiCad field export for part parameters

Add a kicad_export checkbox to parameters, allowing users to control
which specifications appear as fields in the KiCad HTTP library API.
Parameters with kicad_export enabled are included using their formatted
value, without overwriting hardcoded fields like description or Stock.
This commit is contained in:
Sebastian Almberg 2026-02-08 21:46:28 +01:00
parent 44c5d9d727
commit 9178154986
8 changed files with 174 additions and 0 deletions

View file

@ -172,6 +172,13 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
#[Assert\Length(max: 255)]
protected string $group = '';
/**
* @var bool Whether this parameter should be exported as a KiCad field in the EDA HTTP library API
*/
#[Groups(['full', 'parameter:read', 'parameter:write', 'import'])]
#[ORM\Column(type: Types::BOOLEAN)]
protected bool $kicad_export = false;
/**
* Mapping is done in subclasses.
*
@ -471,6 +478,21 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
return static::ALLOWED_ELEMENT_CLASS;
}
public function isKicadExport(): bool
{
return $this->kicad_export;
}
/**
* @return $this
*/
public function setKicadExport(bool $kicad_export): self
{
$this->kicad_export = $kicad_export;
return $this;
}
public function getComparableFields(): array
{
return ['name' => $this->name, 'group' => $this->group, 'element' => $this->element?->getId()];