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