function releaseWorker($workerId) { /** @var $worker WorkerData */ $worker = $this->_workerRepository->getWorker($workerId); if ($worker == null) { throw new ManagerException("Worker with id {$workerId} does'nt exist", self::SERVICE_CATEGORY, self::FAULT_WORKER_DOESNT_EXIST); } if ($worker->status->getValue() !== WorkerStatusEnum::IN_PROGRESS) { throw new ManagerException("Worker with is {$workerId} is not running", self::SERVICE_CATEGORY, self::FAULT_WORKER_IS_NOT_RUNNING); } $workerData = new WorkerData(); $workerData->id = $workerId; $workerData->pid = null; $workerData->startDateTime = null; $workerData->endDateTime = new DateTime(); $workerData->status = new WorkerStatusEnum(WorkerStatusEnum::ACTIVE); $this->_workerRepository->updateWorkerStatus($workerData); }