/** * 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'); } }