Skip to content

getData() -> optional fields standard values #59

Description

@AlphaSoundZ

The function getData() in the file /api/v5/config.php can be optimized:

The optional values yet don't have any other functionality than to be mentionend in the optional_fields response parameter, when data is missing.

An improvement would be the ability to instead of currently doing this:

$data = getData(
    "POST", 
    [
        "table", 
        "columns", 
        "string", 
        "seperator", 
        "linebreak"
    ]
);
$global = (isset($data["global"])) ? $data["global"] : [];
$enclosure = (isset($data["enclosure"])) ? $data["enclosure"] : "";

example of /api/v5/csv/import endpoint

doing the following:

$data = getData(
    "POST", 
    [
        "table", 
        "columns", 
        "string", 
        "seperator", 
        "linebreak"
    ], 
    [
        "global" => [], // "parameter as key" => "default value if not given"
        "enclosure" => ""
    ]
);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions