feat(composant) : create composant slot tables and migrate data from structure JSON

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-03-12 18:20:31 +01:00
parent c01b71fe06
commit 5194543d16
4 changed files with 344 additions and 0 deletions

View File

@@ -109,6 +109,15 @@ class Piece
#[Groups(['piece:read'])]
private Collection $customFieldValues;
/**
* @var Collection<int, Product>
*/
#[ORM\ManyToMany(targetEntity: Product::class, inversedBy: 'linkedPieces')]
#[ORM\JoinTable(name: 'piece_products')]
#[ORM\JoinColumn(name: 'piece_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
#[ORM\InverseJoinColumn(name: 'product_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
private Collection $products;
/**
* @var Collection<int, MachinePieceLink>
*/
@@ -130,6 +139,7 @@ class Piece
$this->constructeurs = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->customFieldValues = new ArrayCollection();
$this->products = new ArrayCollection();
$this->machineLinks = new ArrayCollection();
}
@@ -298,4 +308,28 @@ class Piece
{
return $this->customFieldValues;
}
/**
* @return Collection<int, Product>
*/
public function getProducts(): Collection
{
return $this->products;
}
public function addProduct(Product $product): static
{
if (!$this->products->contains($product)) {
$this->products->add($product);
}
return $this;
}
public function removeProduct(Product $product): static
{
$this->products->removeElement($product);
return $this;
}
}