public function deploy($method) { unset($method['id']); $method['status'] = Resource::STATUS_ACTIVE; if ($method['request'] > 0) { $method['requestCache'] = $this->getSchemaCache($method['request']); } if ($method['response'] > 0) { $method['responseCache'] = $this->getSchemaCache($method['response']); } if ($method['action'] > 0) { $method['actionCache'] = $this->getActionCache($method['action']); } $this->routesMethodTable->create($method); }
/** * Reads all relations of the provided route and writes them to the tables * * @param integer $routeId */ public function updateRelations($routeId) { // remove all existing entries $this->removeExistingRelations($routeId); // get dependencies of the config $methods = $this->routesMethodTable->getMethods($routeId); $schemas = $this->getDependingSchemas($methods); $actions = $this->getDependingActions($methods); foreach ($schemas as $schemaId) { $this->routesSchemaTable->create(array('routeId' => $routeId, 'schemaId' => $schemaId)); } foreach ($actions as $actionId) { $this->routesActionTable->create(array('routeId' => $routeId, 'actionId' => $actionId)); } }
public function delete($actionId) { $action = $this->actionTable->get($actionId); if (!empty($action)) { // check depending if ($this->routesMethodTable->hasAction($actionId)) { throw new StatusCode\BadRequestException('Cannot delete action because a route depends on it'); } // delete route dependencies $this->routesActionTable->deleteByAction($action['id']); $this->actionTable->delete(array('id' => $action['id'])); } else { throw new StatusCode\NotFoundException('Could not find action'); } }
public function delete($schemaId) { $schema = $this->schemaTable->get($schemaId); if (!empty($schema)) { // check whether we have routes which depend on this schema if ($this->routesMethodTable->hasSchema($schemaId)) { throw new StatusCode\BadRequestException('Cannot delete schema because a route depends on it'); } // delete route dependencies $this->routesSchemaTable->deleteBySchema($schema['id']); $this->schemaTable->delete(array('id' => $schema['id'])); } else { throw new StatusCode\NotFoundException('Could not find schema'); } }
public function getAllowedMethods($routeId, $version) { return $this->methodTable->getAllowedMethods($routeId, $version); }