$newGroup = $GroupsTableGateway->find($newGroupId); $outputData = $newGroup; break; case "GET": default: $get_new = $GroupsTableGateway->getEntries(); $outputData = $get_new; } JsonView::render($outputData); })->via('GET', 'POST'); $app->get("/{$v}/groups/:id/?", function ($id = null) use($ZendDb, $acl) { // @TODO need POST and PUT // Hardcoding ID temporarily is_null($id) ? $id = 1 : null; $Groups = new TableGateway($acl, 'directus_groups', $ZendDb); $get_new = $Groups->find($id); JsonView::render($get_new); }); /** * FILES COLLECTION */ $app->map("/{$v}/files(/:id)/?", function ($id = null) use($app, $ZendDb, $acl, $params, $requestPayload) { if (!is_null($id)) { $params['id'] = $id; } $table = "directus_files"; $currentUser = Auth::getUserInfo(); $TableGateway = new TableGateway($acl, $table, $ZendDb); $activityLoggingEnabled = !(isset($_GET['skip_activity_log']) && 1 == $_GET['skip_activity_log']); $activityMode = $activityLoggingEnabled ? TableGateway::ACTIVITY_ENTRY_MODE_PARENT : TableGateway::ACTIVITY_ENTRY_MODE_DISABLED; switch ($app->request()->getMethod()) {
$outputData = $newGroup; break; case 'GET': default: $get_new = $GroupsTableGateway->getEntries(); $outputData = $get_new; } JsonView::render($outputData); })->via('GET', 'POST'); $app->get("/{$v}/groups/:id/?", function ($id = null) use($ZendDb, $acl) { // @TODO need POST and PUT // Hardcoding ID temporarily is_null($id) ? $id = 1 : null; $tableName = 'directus_groups'; $Groups = new TableGateway($acl, $tableName, $ZendDb); $response = $Groups->find($id); if (!$response) { $response = ['message' => __t('unable_to_find_group_with_id_x', ['id' => $id]), 'success' => false]; } $columns = TableSchema::getAllNonAliasTableColumns($tableName); $response = SchemaManager::parseRecordValuesByType($response, $columns); JsonView::render($response); }); /** * FILES COLLECTION */ $app->map("/{$v}/files(/:id)/?", function ($id = null) use($app, $ZendDb, $acl, $params, $requestPayload) { if (!is_null($id)) { $params['id'] = $id; } $table = 'directus_files';