public function __construct(IOpenStackRelease $release, IOpenStackApiVersion $version)
 {
     $message = sprintf('Release %s does not support Api Version %s', $release->getName(), $version->getVersion());
     parent::__construct($message);
 }
 public static function convertApiVersionToArray(IOpenStackApiVersion $version)
 {
     $res = array();
     $res['id'] = $version->getIdentifier();
     $res['version'] = $version->getVersion();
     $res['status'] = $version->getStatus();
     $res['component_id'] = $version->getReleaseComponent()->getIdentifier();
     return $res;
 }
Exemplo n.º 3
0
 /**
  * @param IOpenStackApiVersion $version
  * @return IReleaseSupportedApiVersion
  */
 public function supportsApiVersion(IOpenStackApiVersion $version)
 {
     $version_id = $version->getIdentifier();
     $component_id = $version->getReleaseComponent()->getIdentifier();
     return $this->getComponents('SupportedApiVersions', "ApiVersionID = {$version_id} AND  OpenStackComponentID = {$component_id} ")->First();
 }
 /**
  * @param IOpenStackApiVersion $version
  * @return bool|int
  */
 public function registerVersion(IOpenStackApiVersion $version)
 {
     $res = false;
     $component_repository = $this->component_repository;
     $version_repository = $this->version_repository;
     $this->tx_manager->transaction(function () use(&$res, $version, $component_repository, $version_repository) {
         $component_id = $version->getReleaseComponent()->getIdentifier();
         $component = $component_repository->getById($component_id);
         if (!$component) {
             throw new NotFoundEntityException('OpenStackComponent', sprintf('id %s', $component_id));
         }
         $old_one = $version_repository->getByVersionAndComponent($version->getVersion(), $component_id);
         if ($old_one) {
             throw new EntityAlreadyExistsException('OpenStackApiVersion', sprintf('version %s', $version->getVersion()));
         }
         $res = $version_repository->add($version);
     });
     return $res;
 }