예제 #1
0
 /**
  * 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));
     }
 }
예제 #2
0
파일: Schema.php 프로젝트: apioo/fusio-impl
 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');
     }
 }