feat(custom-fields) : add machineContextOnly flag and link FKs for machine context
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -55,6 +55,10 @@ class CustomField
|
||||
#[Groups(['composant:read', 'piece:read', 'product:read', 'machine:read'])]
|
||||
private bool $required = false;
|
||||
|
||||
#[ORM\Column(type: Types::BOOLEAN, options: ['default' => false], name: 'machinecontextonly')]
|
||||
#[Groups(['composant:read', 'piece:read', 'product:read', 'machine:read'])]
|
||||
private bool $machineContextOnly = false;
|
||||
|
||||
#[ORM\Column(type: Types::STRING, length: 255, nullable: true, name: 'defaultValue')]
|
||||
private ?string $defaultValue = null;
|
||||
|
||||
@@ -220,4 +224,16 @@ class CustomField
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isMachineContextOnly(): bool
|
||||
{
|
||||
return $this->machineContextOnly;
|
||||
}
|
||||
|
||||
public function setMachineContextOnly(bool $machineContextOnly): static
|
||||
{
|
||||
$this->machineContextOnly = $machineContextOnly;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,14 @@ class CustomFieldValue
|
||||
#[ORM\JoinColumn(name: 'productId', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')]
|
||||
private ?Product $product = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: MachineComponentLink::class, inversedBy: 'contextFieldValues')]
|
||||
#[ORM\JoinColumn(name: 'machinecomponentlinkid', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')]
|
||||
private ?MachineComponentLink $machineComponentLink = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: MachinePieceLink::class, inversedBy: 'contextFieldValues')]
|
||||
#[ORM\JoinColumn(name: 'machinepiecelinkid', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')]
|
||||
private ?MachinePieceLink $machinePieceLink = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, name: 'createdAt')]
|
||||
#[Groups(['composant:read', 'piece:read', 'product:read', 'machine:read'])]
|
||||
private DateTimeImmutable $createdAt;
|
||||
@@ -151,4 +159,28 @@ class CustomFieldValue
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMachineComponentLink(): ?MachineComponentLink
|
||||
{
|
||||
return $this->machineComponentLink;
|
||||
}
|
||||
|
||||
public function setMachineComponentLink(?MachineComponentLink $machineComponentLink): static
|
||||
{
|
||||
$this->machineComponentLink = $machineComponentLink;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMachinePieceLink(): ?MachinePieceLink
|
||||
{
|
||||
return $this->machinePieceLink;
|
||||
}
|
||||
|
||||
public function setMachinePieceLink(?MachinePieceLink $machinePieceLink): static
|
||||
{
|
||||
$this->machinePieceLink = $machinePieceLink;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,12 @@ class MachineComponentLink
|
||||
#[ORM\OneToMany(mappedBy: 'parentComponentLink', targetEntity: MachineProductLink::class)]
|
||||
private Collection $productLinks;
|
||||
|
||||
/**
|
||||
* @var Collection<int, CustomFieldValue>
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'machineComponentLink', targetEntity: CustomFieldValue::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
private Collection $contextFieldValues;
|
||||
|
||||
#[ORM\Column(type: Types::STRING, length: 255, nullable: true, name: 'nameOverride')]
|
||||
private ?string $nameOverride = null;
|
||||
|
||||
@@ -92,11 +98,12 @@ class MachineComponentLink
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->createdAt = new DateTimeImmutable();
|
||||
$this->updatedAt = new DateTimeImmutable();
|
||||
$this->childLinks = new ArrayCollection();
|
||||
$this->pieceLinks = new ArrayCollection();
|
||||
$this->productLinks = new ArrayCollection();
|
||||
$this->createdAt = new DateTimeImmutable();
|
||||
$this->updatedAt = new DateTimeImmutable();
|
||||
$this->childLinks = new ArrayCollection();
|
||||
$this->pieceLinks = new ArrayCollection();
|
||||
$this->productLinks = new ArrayCollection();
|
||||
$this->contextFieldValues = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getMachine(): Machine
|
||||
@@ -182,4 +189,12 @@ class MachineComponentLink
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, CustomFieldValue>
|
||||
*/
|
||||
public function getContextFieldValues(): Collection
|
||||
{
|
||||
return $this->contextFieldValues;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,12 @@ class MachinePieceLink
|
||||
#[ORM\OneToMany(mappedBy: 'parentPieceLink', targetEntity: MachineProductLink::class)]
|
||||
private Collection $productLinks;
|
||||
|
||||
/**
|
||||
* @var Collection<int, CustomFieldValue>
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'machinePieceLink', targetEntity: CustomFieldValue::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
private Collection $contextFieldValues;
|
||||
|
||||
#[ORM\Column(type: Types::STRING, length: 255, nullable: true, name: 'nameOverride')]
|
||||
private ?string $nameOverride = null;
|
||||
|
||||
@@ -85,9 +91,10 @@ class MachinePieceLink
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->createdAt = new DateTimeImmutable();
|
||||
$this->updatedAt = new DateTimeImmutable();
|
||||
$this->productLinks = new ArrayCollection();
|
||||
$this->createdAt = new DateTimeImmutable();
|
||||
$this->updatedAt = new DateTimeImmutable();
|
||||
$this->productLinks = new ArrayCollection();
|
||||
$this->contextFieldValues = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getMachine(): Machine
|
||||
@@ -185,4 +192,12 @@ class MachinePieceLink
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, CustomFieldValue>
|
||||
*/
|
||||
public function getContextFieldValues(): Collection
|
||||
{
|
||||
return $this->contextFieldValues;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user