clients as $client) { /** @var Client $client */ $client = $client->getEntity(); $repository = $client->getRepository(); if (!$repository->getIp()) { throw new ValidatorException('IP is required'); } $params = [ 'json' => [ 'broadcast_ip' => '255.255.255.255', 'mac' => $client->getMac() ] ]; $this->logger->info('Sending WoL to client', ['mac' => $client->getMac()]); $content = $this->createRequest('POST', 'http://'.$repository->getIp(). ':8006/ogrepository/v1/wol', $params); if (isset($content['error']) && $content['error'] === Response::HTTP_INTERNAL_SERVER_ERROR ) { $this->logger->error('Error sending WoL to client', ['mac' => $client->getMac()]); continue; } $client->setStatus(ClientStatus::INITIALIZING); $this->entityManager->persist($client); $this->entityManager->flush(); $this->createService->__invoke($client, CommandTypes::POWER_ON, TraceStatus::SUCCESS, '', []); } return new JsonResponse(data: [], status: Response::HTTP_OK); } }