SDK
SDK PHP v3.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

setContent #

Replaces the current content with new data.
This is a helper function returning a reference to itself so that you can easily chain calls.

Changes made by this function won't be applied until the save method is called


setContent(data, [replace]) #

ArgumentsTypeDescription
dataJSON ObjectNew content
replacebooleantrue: replace the current content with the provided data, false: merge it

Note: by default, the replace argument is set to false


Return Value #

Returns this Document object to allow chaining.

Usage #

<?php
use \Kuzzle\Document;
// ...
$documentContent = [
  'field' => 'value'
];
/**
  * @var $document Document
  */
$document->setContent($documentContent);