getIp()) { throw new BadRequestHttpException('Client has no IP address assigned'); } $subnet = $data->getSubnet(); if (!$subnet) { throw new BadRequestHttpException('Client has no subnet associated'); } $dhcpServer = $subnet->getDhcpServer(); if (!$dhcpServer) { throw new BadRequestHttpException('Subnet has no DHCP server associated'); } $port = $dhcpServer->getApiPort() ?? 8081; $url = sprintf('http://%s:%d/ogdhcp/v1/leases/%s', $dhcpServer->getIp(), $port, $data->getIp()); $content = $this->createRequest('DELETE', $url); return new JsonResponse(data: $content, status: Response::HTTP_OK); } }