Skip to content

Unable to save entity with integer in a 'text' type column #33

@123andy

Description

@123andy

In validateProperty we take a pretty strict definition (by php standards) for the columns defined as 'text'. A php number will be rejected. In my case, I had an array key that was numeric (for one record_id) and when I tried to save it into an entity defined as a 'text' field (as some other records are alpha) - it failed.

I had to explicitly cast it as a string in the payload to the entity before trying to create the new record. One might consider allowing numeric integers as well to be more 'REDCap-like'...

            case 'text':
                if (!is_string($value)) {
                    return false;
                }
                break;

Or, am I missing something here...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions