feat(fournisseurs) : categories (M2M) + telephones (1-N) + import customer.json
All checks were successful
Auto Tag Develop / tag (push) Successful in 9s
All checks were successful
Auto Tag Develop / tag (push) Successful in 9s
- Nouvelles entites ConstructeurCategorie (referentiel M2M) et ConstructeurTelephone (1-N) - Constructeur : retrait colonne phone, ajout collections telephones/categories, groupes de serialisation constructeur:read/write - Migration : cree les 3 tables, migre la colonne phone existante vers constructeur_telephone, drop phone - Commande app:import-fournisseurs (dry-run par defaut, --force) : non destructive, find-or-create par nom, ne touche jamais un ID existant, ajout-seulement pour telephones/categories - MAJ MCP tools / MachineStructureController / audit subscriber / tests - Frontend : page constructeurs avec telephones multiples + categories (tableau, filtre, formulaire), composable useConstructeurCategories, composant ConstructeurCategorieSelect Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,8 @@ use App\Entity\ComposantPieceSlot;
|
||||
use App\Entity\ComposantProductSlot;
|
||||
use App\Entity\ComposantSubcomponentSlot;
|
||||
use App\Entity\Constructeur;
|
||||
use App\Entity\ConstructeurCategorie;
|
||||
use App\Entity\ConstructeurTelephone;
|
||||
use App\Entity\CustomField;
|
||||
use App\Entity\CustomFieldValue;
|
||||
use App\Entity\Machine;
|
||||
@@ -250,7 +252,12 @@ abstract class AbstractApiTestCase extends ApiTestCase
|
||||
$c = new Constructeur();
|
||||
$c->setName($name);
|
||||
$c->setEmail($email);
|
||||
$c->setPhone($phone);
|
||||
|
||||
if (null !== $phone) {
|
||||
$tel = new ConstructeurTelephone();
|
||||
$tel->setNumero($phone);
|
||||
$c->addTelephone($tel);
|
||||
}
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
$em->persist($c);
|
||||
@@ -259,6 +266,32 @@ abstract class AbstractApiTestCase extends ApiTestCase
|
||||
return $c;
|
||||
}
|
||||
|
||||
protected function createConstructeurCategorie(string $name = 'Catégorie Test'): ConstructeurCategorie
|
||||
{
|
||||
$categorie = new ConstructeurCategorie();
|
||||
$categorie->setName($name);
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
$em->persist($categorie);
|
||||
$em->flush();
|
||||
|
||||
return $categorie;
|
||||
}
|
||||
|
||||
protected function createConstructeurTelephone(Constructeur $constructeur, string $numero = '0102030405', ?string $label = null): ConstructeurTelephone
|
||||
{
|
||||
$tel = new ConstructeurTelephone();
|
||||
$tel->setConstructeur($constructeur);
|
||||
$tel->setNumero($numero);
|
||||
$tel->setLabel($label);
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
$em->persist($tel);
|
||||
$em->flush();
|
||||
|
||||
return $tel;
|
||||
}
|
||||
|
||||
protected function createMachineConstructeurLink(Machine $machine, Constructeur $constructeur, ?string $supplierReference = null): MachineConstructeurLink
|
||||
{
|
||||
$link = new MachineConstructeurLink();
|
||||
|
||||
@@ -33,9 +33,9 @@ class ConstructeurTest extends AbstractApiTestCase
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
$this->assertJsonContains([
|
||||
'name' => 'Siemens',
|
||||
'email' => 'contact@siemens.com',
|
||||
'phone' => '+33123456789',
|
||||
'name' => 'Siemens',
|
||||
'email' => 'contact@siemens.com',
|
||||
'telephones' => [['numero' => '+33123456789']],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -78,11 +78,32 @@ class ConstructeurTest extends AbstractApiTestCase
|
||||
$client = $this->createGestionnaireClient();
|
||||
$client->request('PATCH', self::iri('constructeurs', $c->getId()), [
|
||||
'headers' => ['Content-Type' => 'application/merge-patch+json'],
|
||||
'json' => ['phone' => '+33987654321'],
|
||||
'json' => ['email' => 'updated@siemens.com'],
|
||||
]);
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
$this->assertJsonContains(['phone' => '+33987654321']);
|
||||
$this->assertJsonContains(['email' => 'updated@siemens.com']);
|
||||
}
|
||||
|
||||
public function testPatchCategories(): void
|
||||
{
|
||||
$c = $this->createConstructeur('Siemens');
|
||||
$cat1 = $this->createConstructeurCategorie('Transporteur');
|
||||
$cat2 = $this->createConstructeurCategorie('Organisme de formation');
|
||||
|
||||
$client = $this->createGestionnaireClient();
|
||||
$client->request('PATCH', self::iri('constructeurs', $c->getId()), [
|
||||
'headers' => ['Content-Type' => 'application/merge-patch+json'],
|
||||
'json' => ['categories' => [
|
||||
self::iri('constructeur_categories', $cat1->getId()),
|
||||
self::iri('constructeur_categories', $cat2->getId()),
|
||||
]],
|
||||
]);
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
$client->request('GET', self::iri('constructeurs', $c->getId()));
|
||||
$this->assertResponseIsSuccessful();
|
||||
$this->assertJsonContains(['categories' => [['name' => 'Transporteur'], ['name' => 'Organisme de formation']]]);
|
||||
}
|
||||
|
||||
public function testDelete(): void
|
||||
|
||||
Reference in New Issue
Block a user