public function toArray()
{
$doc = $this->getParams();
$doc['_source'] = $this->getData();
return $doc;
}
/** * @group unit */ public function testToArray() { $id = 17; $data = array('hello' => 'world'); $type = 'testtype'; $index = 'textindex'; $doc = new Document($id, $data, $type, $index); $result = array('_index' => $index, '_type' => $type, '_id' => $id, '_source' => $data); $this->assertEquals($result, $doc->toArray()); }