public function current() { $item = $this->_rowset[$this->_pointer]; $document = new DbDocument\Document\Riak($this->_collection, $item[DbDocument\Adapter\Riak::DATA]); $document->setId($item[DbDocument\Adapter\Riak::PRIMARY]); return $document; }
public function findOne($collectionName, $query, array $fields = array()) { $this->_connect(); $request = $this->_buildRequest($collectionName, $query, $fields); $response = $this->_connection->restPost('/mapred', \Zend\Json\Encoder::encode($request)); if ($response->isError()) { return null; } $items = \Zend\Json\Decoder::decode($response->getBody()); $item = array_shift($items); $document = new DbDocument\Document\Riak($this->getCollection($collectionName), $item[self::DATA]); $document->setId($item[self::PRIMARY]); return $document; }