saveObject() public method

Override the content of object.
public saveObject ( array $object, string $objectIDKey = 'objectID' ) : mixed
$object array contains the object to save, the object must contains an objectID attribute or attribute specified in $objectIDKey considered as objectID
$objectIDKey string
return mixed
Ejemplo n.º 1
0
 /**
  * Add or update the given searchable subject to the index.
  *
  * @param Searchable $subject
  */
 public function upsertToIndex(Searchable $subject)
 {
     $this->index->saveObject(array_merge($subject->getSearchableBody(), ['objectID' => $this->getAlgoliaId($subject)]));
 }
Ejemplo n.º 2
0
 public function it_adds_a_searchable_object_to_the_search_index(\AlgoliaSearch\Index $index, Searchable $searchableObject)
 {
     $index->saveObject(array_merge($this->searchableBody, ['objectID' => $this->searchableType . '-' . $this->searchableId]))->shouldBeCalled();
     $this->upsertToIndex($searchableObject);
 }