protected function registerCapability(IOpenStackImplementation $implementation, IOpenStackImplementationApiCoverage $capability) { //check release $release = $this->release_repository->getById($capability->getReleaseSupportedApiVersion()->getRelease()->getIdentifier()); if (!$release) { throw new NotFoundEntityException('', ''); } //check component $component = $this->component_repository->getById($capability->getReleaseSupportedApiVersion()->getOpenStackComponent()->getIdentifier()); if (!$component) { throw new NotFoundEntityException('', ''); } if (!$release->supportsComponent($component->getCodeName())) { throw new InvalidAggregateRootException('', '', '', ''); } if ($component->getSupportsVersioning()) { //check api version $api_version = $this->api_version_repository->getByIdAndComponent($capability->getReleaseSupportedApiVersion()->getApiVersion()->getIdentifier(), $component->getIdentifier()); if (!$api_version) { throw new NotFoundEntityException('', ''); } } else { $api_version = $capability->getReleaseSupportedApiVersion()->getApiVersion(); $api_version->setReleaseComponent($component); } $release_supported_api = $release->supportsApiVersion($api_version); if (!$release_supported_api) { throw new InvalidAggregateRootException('', '', '', ''); } $capability->setReleaseSupportedApiVersion($release_supported_api); $implementation->addCapability($capability); }
public function getVersion() { $component_id = (int) $this->request->param('COMPONENT_ID'); $version_id = (int) $this->request->param('VERSION_ID'); $version = $this->version_repository->getByIdAndComponent($version_id, $component_id); if (!$version) { return $this->notFound(); } return $this->ok(self::convertApiVersionToArray($version)); }