src/Resources/DbSchemaResource.php
public function describeTableRelationships($table_name, $relationships = null, $refresh = false)
    {
        /** @var TableSchema $table */
        $table = $this->parent->getTableSchema($table_name, $refresh);
        if (!$table) {
            throw new NotFoundException("Table '$table_name' does not exist in the database.");
        }

        if (!empty($relationships)) {
            $relationships = static::validateAsArray($relationships, ',', true, 'No valid relationship names given.');
        }

        $out = [];
        try {
            /** @var RelationSchema $relation */
            foreach ($table->relations as $relation) {
                if (empty($relationships) || (false !== array_search($relation->name, $relationships))) {
                    $out[] = $relation->toArray();
                }
            }
        } catch (\Exception $ex) {
            throw new InternalServerErrorException("Failed to query table relationship schema.\n{$ex->getMessage()}");
        }

        if (empty($out)) {
            throw new NotFoundException("No requested relationships found in table '$table_name'.");
        }

        return $out;
    }
public function describeTableRelationships($table_name, $relationships = null, $refresh = false)
    {
        /** @var TableSchema $table */
        $table = $this->parent->getTableSchema($table_name, $refresh);
        if (!$table) {
            throw new NotFoundException("Table '$table_name' does not exist in the database.");
        }

        if (!empty($relationships)) {
            $relationships = static::validateAsArray($relationships, ',', true, 'No valid relationship names given.');
        }

        $out = [];
        try {
            /** @var RelationSchema $relation */
            foreach ($table->relations as $relation) {
                if (empty($relationships) || (false !== array_search($relation->name, $relationships))) {
                    $out[] = $relation->toArray();
                }
            }
        } catch (\Exception $ex) {
            throw new InternalServerErrorException("Failed to query table relationship schema.\n{$ex->getMessage()}");
        }

        if (empty($out)) {
            throw new NotFoundException("No requested relationships found in table '$table_name'.");
        }

        return $out;
    }
@param string                $table_name
@param null | string | array $relationships
@param bool                  $refresh

@return array
@throws BadRequestException
@throws InternalServerErrorException
@throws NotFoundException
@throws \Exception