We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Mar 22, 2021 6:23 PM
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
}
Solved! Go to Solution.
Mar 24, 2021 4:18 PM
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.
Mar 24, 2021 4:18 PM
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.
Mar 23, 2021 12:19 PM
Did you figure this or should we unleash our php experts here as well 😀
![]() | Make sure to subscribe to our YouTube channel where you can find the HubSpot Community Developer Show |