Invalid value for enum '\Pipedrive\ Model\ FieldTypeAsString'


I’m using “client-php” and this is my code:

            $personFieldsApiInstance = new PersonFieldsApi(null, $this->pipedrive);
            $searchPersonFields = $personFieldsApiInstance->getPersonFields();

It’s a very, very simple test to get all person fields.

The problem is I’m getting this error:

  #message: "Invalid value for enum '\Pipedrive\Model\FieldTypeAsString', must be one of: 'address', 'date', 'daterange', 'double', 'enum', 'monetary', 'org', 'people', 'phone', 'set', 'text', 'time', 'timerange', 'user', 'varchar', 'varchar_auto', 'visible_to' "
  #code: 0
  #file: "/home/marlon-alves/dev/lunatic-app/vendor/pipedrive/pipedrive/lib/ObjectSerializer.php"
  #line: 375

Debugging the code, the exception is throwed when ObjectSerializer tries to serialize the fields “ID” (type “int”) and “Profile picture” (type “picture”).

I’ve tested make these changes on FieldTypeAsString.

  1. added two new “consts”
    const INT = ‘int’;
    const PICTURE = ‘picture’;

  2. added these “consts” to “getAllowableEnumValues”

These changes solved the problem, but I don’t want to make changes on “vendor” directory.

Can someone helps me?

1 Like

Thank you for sharing your workaround to this issue.
Following your changes worked like a charm!