public function begin()
{
$request = new Request('POST', sprintf('%s/db/data/transaction', $this->uri));
try {
return $this->httpClient->send($request);
} catch (RequestException $e) {
if ($e->hasResponse()) {
$body = json_decode($e->getResponse()->getBody(), true);
if (!isset($body['code'])) {
throw $e;
}
$msg = sprintf('Neo4j Exception with code "%s" and message "%s"', $body['errors'][0]['code'], $body['errors'][0]['message']);
$exception = new Neo4jException($msg);
$exception->setNeo4jStatusCode($body['errors'][0]['code']);
throw $exception;
}
throw $e;
}
}