Elastica\Response::setJsonBigintConversion PHP Méthode

setJsonBigintConversion() public méthode

Sets whether or not to apply bigint conversion on the JSON result.
public setJsonBigintConversion ( boolean $jsonBigintConversion )
$jsonBigintConversion boolean
    public function setJsonBigintConversion($jsonBigintConversion)
    {
        $this->_jsonBigintConversion = $jsonBigintConversion;
    }

Usage Example

Exemple #1
0
 /**
  * Makes calls to the elasticsearch server.
  *
  * All calls that are made to the server are done through this function
  *
  * @param \Elastica\Request $request
  * @param array             $params  Host, Port, ...
  *
  * @throws \Elastica\Exception\ConnectionException
  * @throws \Elastica\Exception\ResponseException
  * @throws \Elastica\Exception\Connection\HttpException
  *
  * @return \Elastica\Response Response object
  */
 public function exec(Request $request, array $params)
 {
     $connection = $this->getConnection();
     $client = $this->_getGuzzleClient($this->_getBaseUrl($connection), $connection->isPersistent());
     $options = array('exceptions' => false);
     if ($connection->getTimeout()) {
         $options['timeout'] = $connection->getTimeout();
     }
     $proxy = $connection->getProxy();
     // See: https://github.com/facebook/hhvm/issues/4875
     if (is_null($proxy) && defined('HHVM_VERSION')) {
         $proxy = getenv('http_proxy') ?: null;
     }
     if (!is_null($proxy)) {
         $options['proxy'] = $proxy;
     }
     $req = $this->_createPsr7Request($request, $connection);
     try {
         $start = microtime(true);
         $res = $client->send($req, $options);
         $end = microtime(true);
     } catch (TransferException $ex) {
         throw new GuzzleException($ex, $request, new Response($ex->getMessage()));
     }
     $response = new Response((string) $res->getBody(), $res->getStatusCode());
     $response->setQueryTime($end - $start);
     if ($connection->hasConfig('bigintConversion')) {
         $response->setJsonBigintConversion($connection->getConfig('bigintConversion'));
     }
     $response->setTransferInfo(array('request_header' => $request->getMethod(), 'http_code' => $res->getStatusCode()));
     if ($response->hasError()) {
         throw new ResponseException($request, $response);
     }
     if ($response->hasFailedShards()) {
         throw new PartialShardFailureException($request, $response);
     }
     return $response;
 }
All Usage Examples Of Elastica\Response::setJsonBigintConversion