algolia/algoliasearch-client-php

TypeError: Cannot access offset of type string on string

ImJustToNy opened this issue · 2 comments

  • Algolia Client Version: 3.1.0
  • Language Version: 8.0.11

Description

When you try to use RecommendedClilent()->getRelatedProducts() it throws an error.
image

Steps To Reproduce

RecommendClient::create('foo', 'bar', 'baz')->getRelatedProducts([ 'indexName' => 'example', 'objectID' => '5' ])

Hi @ImJustToNy ,
Thank you for reporting this.

The parameter to getRelatedProducts should be an array of arrays, can you check with the following code, please?

RecommendClient::create('foo', 'bar', 'baz')->getRelatedProducts([[ 'indexName' => 'example', 'objectID' => '5' ]]);

Thank you in advance!

Oh! My bad. Thank you for your help, it works just fine now.