requireRole($this->security, 'ROLE_GESTIONNAIRE'); $composant = $this->composants->find($composantId); if (!$composant) { $this->mcpError('not_found', "Composant not found: {$composantId}"); } $this->em->remove($composant); $this->em->flush(); return $this->jsonResponse(['deleted' => true, 'id' => $composantId]); } }