Basho\Riak\Object::setContentType PHP Method

setContentType() public method

If set to application/json or text/json the object data will automatically be json_encoded upon transfer to Riak.
public setContentType ( string $content_type )
$content_type string
    public function setContentType($content_type)
    {
        $this->content_type = $content_type;
        return $this;
    }

Usage Example

Beispiel #1
0
 /**
  * Mint a new Object instance with a json encoded string
  *
  * @param mixed $data
  *
  * @return $this
  */
 public function buildJsonObject($data)
 {
     $this->object = new RObject();
     $this->object->setData($data);
     $this->object->setContentType(Http::CONTENT_TYPE_JSON);
     return $this;
 }
All Usage Examples Of Basho\Riak\Object::setContentType