fix(constructeurs) : persist supplier removal on Piece, Composant and Product
- Frontend: always include constructeurs key in PATCH payload even when empty, so merge-patch+json actually clears the relation - Backend: add setConstructeurs() on Piece and Product entities (Composant already had it) so API Platform can replace the ManyToMany collection Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Submodule Inventory_frontend updated: a730a18794...ac860d3165
@@ -244,6 +244,22 @@ class Piece
|
||||
return $this->constructeurs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param iterable<Constructeur> $constructeurs
|
||||
*/
|
||||
public function setConstructeurs(iterable $constructeurs): static
|
||||
{
|
||||
$this->constructeurs = new ArrayCollection();
|
||||
|
||||
foreach ($constructeurs as $constructeur) {
|
||||
if ($constructeur instanceof Constructeur && !$this->constructeurs->contains($constructeur)) {
|
||||
$this->constructeurs->add($constructeur);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addConstructeur(Constructeur $constructeur): static
|
||||
{
|
||||
if (!$this->constructeurs->contains($constructeur)) {
|
||||
|
||||
@@ -199,6 +199,22 @@ class Product
|
||||
return $this->constructeurs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param iterable<Constructeur> $constructeurs
|
||||
*/
|
||||
public function setConstructeurs(iterable $constructeurs): static
|
||||
{
|
||||
$this->constructeurs = new ArrayCollection();
|
||||
|
||||
foreach ($constructeurs as $constructeur) {
|
||||
if ($constructeur instanceof Constructeur && !$this->constructeurs->contains($constructeur)) {
|
||||
$this->constructeurs->add($constructeur);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addConstructeur(Constructeur $constructeur): static
|
||||
{
|
||||
if (!$this->constructeurs->contains($constructeur)) {
|
||||
|
||||
Reference in New Issue
Block a user