APIs & Integrations

danhammari
Contributor

php docblock uses unfamiliar property type "map"

SOLVE

I am trying to implement a SimplePublicObject in PHP but the docblock syntax describes a property type name "map" that is not a valid PHP type. Here is an example from the SimplePublicObject that CRM Deals implements:

namespace: HubSpot\Client\Crm\Deals\Model

    class: SimplePublicObject

   method: setProperties

 

    /**
     * Sets properties
     *
     * @param map[string,string] $properties properties
     *
     * @return $this
     */
    public function setProperties($properties)
    {
        $this->container['properties'] = $properties;

        return $this;
    }

 

The property type of map appears to be a simple array, but I would expect to pass in an associative array with key/value pairs. I suspect that the OpenAPI Generator that builds the PHP docblock is not configured correctly.

 

Could someone point out the correct native PHP variable type for the setProperties() method?

 

Can the Hubspot API team review the OpenAPI Generator output and see if there is a way to output the "map" param type as an array type instead? For example:

 

@param string[] $varname

OR

@param array $varname{

@type boolean $keyname1

@type string $keyname2

}

0 Upvotes
1 Accepted solution
danhammari
Solution
Contributor

php docblock uses unfamiliar property type "map"

SOLVE

It looks like the param map[string,string] is trying to indicate that I should pass in an associative array where both the keys and values should be variable typed as strings. I will treat both input and outputs with this docblock designation as PHP native associative arrays and watch for any error messages.

View solution in original post

2 Replies 2
danhammari
Solution
Contributor

php docblock uses unfamiliar property type "map"

SOLVE

It looks like the param map[string,string] is trying to indicate that I should pass in an associative array where both the keys and values should be variable typed as strings. I will treat both input and outputs with this docblock designation as PHP native associative arrays and watch for any error messages.

dennisedson
HubSpot Product Team
HubSpot Product Team

php docblock uses unfamiliar property type "map"

SOLVE

@danhammari 

Did you figure this or should we unleash our php experts here as well 😀

0 Upvotes