constructeurs->find($constructeurId); if (!$constructeur) { $this->mcpError('not_found', "Constructeur not found: {$constructeurId}"); } $telephones = array_map( static fn ($t): array => ['id' => $t->getId(), 'numero' => $t->getNumero(), 'label' => $t->getLabel()], $constructeur->getTelephones()->toArray(), ); $categories = array_values(array_filter(array_map( static fn ($c): ?string => $c->getName(), $constructeur->getCategories()->toArray(), ))); return $this->jsonResponse([ 'id' => $constructeur->getId(), 'name' => $constructeur->getName(), 'email' => $constructeur->getEmail(), 'telephones' => array_values($telephones), 'categories' => $categories, 'createdAt' => $constructeur->getCreatedAt()->format('Y-m-d H:i:s'), 'updatedAt' => $constructeur->getUpdatedAt()->format('Y-m-d H:i:s'), ]); } }