incraigulous / contentful-sdk

A modern PHP SDK for Contentful delivery and management APIs.
MIT License
14 stars 11 forks source link

int value not accepted in EntryField builder when put()ing an entry #16

Open danships opened 8 years ago

danships commented 8 years ago

Hi,

Great SDK implementation, better than the contentful one. I ran into an issue with the Management SDK.

When I use an int as the value for an EntryField, an Exception is thrown because the parseContent function attempts to interpret the value as an array.

PHP Warning: Invalid argument supplied for foreach() in /home/daan/git/talpa/dancedancedance-s2-middleware-php/vendor/incraigulous/contentful-sdk/src/PayloadBuilders/EntryField.php on line 101

I can work around it by explicitly casting to a string when setting the value, but a better way would be to fix this in the EntryField class perhaps.