client; /** @var Client $clientEntity */ $clientEntity = $client->getEntity(); $data = [ 'host' => $clientEntity->getName(), 'macAddress' => strtolower($clientEntity->getMac()), 'address' => $clientEntity->getIp(), ]; $params = [ 'json' => $data ]; $content = $this->createRequest($httpClient, 'POST', 'http://'.$this->ogDhcpApiUrl.'/ogdhcp/v1/subnets/'.$subnet->getServerId().'/hosts', $params); $subnet->addClient($clientEntity); $this->entityManager->persist($subnet); $this->entityManager->flush(); return new JsonResponse(data: $content, status: Response::HTTP_OK); } }