Nosto/nosto-php-sdk

UpsertProduct Operation is not using the "toJson()" method of the Products

Closed this issue · 2 comments

UpsertProduct::upsert() is using:
$response = $request->post($this->collection); to send the Products.

The ApiRequest::post() is using:
return $this->postRaw(SerializationHelper::serialize($content));

I suggest a AbstractCollection::toJson() method, which is calling the AbstractObject::toJson() method.

BONUS: Automatic UTF-8 Conversion if necessary ;-)

Added in 3.2.1. Please note, you don't really need to call toJson for the objects as the HttpRequest takes care of the serialization (https://github.com/Nosto/nosto-php-sdk/blob/develop/src/Request/Http/HttpRequest.php#L419)

Yes, but my Objects are filled with ISO-8895-1 data, because I need that for the frontend-tags.
If the toJson() method would get called, i could simply transfer the data to UTF-8 by overwriting the toJson() method.