refactor(constructeur) : replace ManyToMany with OneToMany to ConstructeurLink entities

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-03-31 14:12:17 +02:00
parent 2d33c97449
commit 26be0b655d
5 changed files with 48 additions and 178 deletions
+18 -18
View File
@@ -63,37 +63,37 @@ class Constructeur
private DateTimeImmutable $updatedAt;
/**
* @var Collection<int, Machine>
* @var Collection<int, MachineConstructeurLink>
*/
#[ORM\ManyToMany(targetEntity: Machine::class, mappedBy: 'constructeurs')]
private Collection $machines;
#[ORM\OneToMany(mappedBy: 'constructeur', targetEntity: MachineConstructeurLink::class, cascade: ['remove'])]
private Collection $machineLinks;
/**
* @var Collection<int, Composant>
* @var Collection<int, ComposantConstructeurLink>
*/
#[ORM\ManyToMany(targetEntity: Composant::class, mappedBy: 'constructeurs')]
private Collection $composants;
#[ORM\OneToMany(mappedBy: 'constructeur', targetEntity: ComposantConstructeurLink::class, cascade: ['remove'])]
private Collection $composantLinks;
/**
* @var Collection<int, Piece>
* @var Collection<int, PieceConstructeurLink>
*/
#[ORM\ManyToMany(targetEntity: Piece::class, mappedBy: 'constructeurs')]
private Collection $pieces;
#[ORM\OneToMany(mappedBy: 'constructeur', targetEntity: PieceConstructeurLink::class, cascade: ['remove'])]
private Collection $pieceLinks;
/**
* @var Collection<int, Product>
* @var Collection<int, ProductConstructeurLink>
*/
#[ORM\ManyToMany(targetEntity: Product::class, mappedBy: 'constructeurs')]
private Collection $products;
#[ORM\OneToMany(mappedBy: 'constructeur', targetEntity: ProductConstructeurLink::class, cascade: ['remove'])]
private Collection $productLinks;
public function __construct()
{
$this->createdAt = new DateTimeImmutable();
$this->updatedAt = new DateTimeImmutable();
$this->machines = new ArrayCollection();
$this->composants = new ArrayCollection();
$this->pieces = new ArrayCollection();
$this->products = new ArrayCollection();
$this->createdAt = new DateTimeImmutable();
$this->updatedAt = new DateTimeImmutable();
$this->machineLinks = new ArrayCollection();
$this->composantLinks = new ArrayCollection();
$this->pieceLinks = new ArrayCollection();
$this->productLinks = new ArrayCollection();
}
public function getName(): ?string