Ejemplo n.º 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));
     }
 }
Ejemplo n.º 2
0
 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');
     }
 }