public begin ( ) : Psr\Http\Message\ResponseInterface | ||
return | Psr\Http\Message\ResponseInterface |
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;
}
}
/** * {@inheritdoc} */ public function begin() { $this->assertNotStarted(); $response = $this->session->begin(); $body = json_decode($response->getBody(), true); $parts = explode('/', $body['commit']); $this->transactionId = (int) $parts[count($parts) - 2]; $this->state = self::OPENED; $this->session->transaction = $this; }