# WT4 — CarrierProcessor (ticket 1.6 / ERP-158) > ```bash > git fetch origin > git worktree add ../sb-erp158-processor -b feat/erp-158-carrier-processor origin/develop > cd ../sb-erp158-processor && claude > ``` > **Base** : `origin/develop` **après merge de WT3** (entités Carrier) **et WT1** (upload, pour la décharge). --- ## Prompt à coller Projet Starseed (Symfony 8 / API Platform 4, DDD). Lis `CLAUDE.md`, `.claude/rules/backend.md`. Charge le skill `backend-entity-conventions`. **Mission** : logique d'écriture du formulaire principal Carrier (POST/PATCH) — normalisation, champs conditionnels, archivage. **Miroir** : `src/Module/Commercial/Infrastructure/ApiPlatform/State/Processor/SupplierProcessor.php` + `Application/Service/SupplierFieldNormalizer.php`. **Spec** : `spec-back.md § 4.3 / 4.4 / 7`. **Règles métier à implémenter (un test PHPUnit par RG)** : - **RG-4.01** : POST avec `qualimatCarrier` → `certificationType=QUALIMAT` + FK persistée ; cas LIOT (`name='LIOT'`) ⇒ `certificationType` non requis, `liotPlates` accepté. - **RG-4.02** : `certificationType='AUTRE'` sans `dischargeDocument` → **422** (`#[Assert\Callback]`). - **RG-4.03** : `isChartered=true` sans `indexationRate` / `containerType` / `volumeM3` → **422**. - **RG-4.13** : normalisation via `CarrierFieldNormalizer` (miroir Supplier) — `name` UPPER, contacts Capitalize, phones digits-only, email lower, `liotPlates` (`;`-split/trim/UPPER). - **RG-4.12** : doublon `name` (parmi actifs) → **409** + `setError` ciblé. - **RG-4.14** : PATCH `isArchived` exige `transport.carriers.archive` (Admin) ; mode strict → 403 sinon. **Pièges** : - Messages de validation **FR explicites** sur chaque contrainte (`EntityConstraintsHaveFrenchMessageTest`). - Le back renvoie **toutes** les violations d'un coup avec `propertyPath` aligné sur les champs front. **Scope STRICT** : `CarrierProcessor` + `CarrierFieldNormalizer` + contraintes sur l'entité `Carrier` (formulaire principal). **NE TOUCHE PAS** : les sous-ressources adresses/contacts/prix (WT6/7/8), `CarrierFixtures` (WT10), l'export (WT9). Ajoute tes contraintes sur `Carrier` sans réécrire l'ApiResource posée par WT3. **Fini quand** : `make test` vert + `make php-cs-fixer-allow-risky`. Commit (`--no-verify` si vert), puis **ouvre la PR** : ```bash git push -u origin feat/erp-158-carrier-processor tea pr create --base develop --head feat/erp-158-carrier-processor \ --title "feat(transport) : CarrierProcessor (RG-4.01→4.03/4.12→4.14) (ERP-158)" \ --description "Normalisation + champs conditionnels + archive. Ticket ERP-158." ``` Puis labellise via l'API Gitea. Cible **develop**. Aucune mention IA.