/** * Executes a view query. * * @param ViewQuery $queryObj * @return mixed * @throws CouchbaseException * * @internal */ public function _view($queryObj) { $path = $queryObj->toString(); $res = $this->me->http_request(1, 1, $path, NULL, 1); $out = json_decode($res, true); if (isset($out['error'])) { throw new CouchbaseException($out['error'] . ': ' . $out['reason']); } return $out; }
/** * Executes a view query. * * @param ViewQuery $queryObj * @return mixed * @throws CouchbaseException * * @internal */ public function _view($queryObj, $json_asarray) { $path = $queryObj->toString(); $res = $this->me->http_request(1, 1, $path, NULL, 1); $out = json_decode($res, $json_asarray); if ($json_asarray) { if (isset($out['error'])) { throw new CouchbaseException($out['error'] . ': ' . $out['reason']); } } else { if (isset($out->error)) { throw new CouchbaseException($out->error . ': ' . $out->reason); } } return $out; }