Fix Contact 'company' property filtered due to 'Companies' HubSpot type #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is pretty much a duplicate issue of a previous pull request but for the company property
#21
Changes:
Modified the isAllowedProperty method to access the protected array $allowedproperties
Added company and email to this array
This fix ensures that:
The company property is correctly retained and accessible
The code no longer attempts to access the Companies associated type when simply trying to get the company property from a Contact
The original intent of filtering out most HubSpot types is maintained, while solving this specific edge case.
This change should resolve issues for users who were encountering unexpected scope errors when working with contact companies.
Bug Demonstration
Currently, if you run this code:
$contact = Contact::find(555);
dd($contact->company);
If you have the scope access then a Company HubSpot type is returned instead of a simple string.