public function getCurrentPrivateCloud() { $private_cloud_id = intval($this->request->getVar('id')); $is_draft = intval($this->request->getVar('is_draft')); $private_cloud = false; if ($private_cloud_id > 0) { if ($is_draft) { $private_cloud = $this->private_clouds_draft_repository->getById($private_cloud_id); } else { $private_cloud = $this->private_clouds_draft_repository->getByLiveServiceId($private_cloud_id); } //if no draft found we pull the live one to create the draft from it when saved if (!$private_cloud) { $private_cloud = $this->private_clouds_repository->getById($private_cloud_id); } } return $private_cloud; }