I tried to use $transaction->isError() and $transaction->isClosed in neo4j transaction, but these functions failed to catch the error. Here is my code, where I did the transaction roll-back after committing, which according to the documentation should produce an error and it should be handled by isClosed(), but it never handled the error rather produced the error.
code
require("vendor/autoload.php");
use Everyman\Neo4j\Cypher\Query;
$client = new Everyman\Neo4j\Client();
$transaction = $client->beginTransaction();
$queryA = new Query($client, 'CREATE (n:testing{id:189})');
$result = $transaction->addStatements($queryA);
$transaction->commit();
$transaction->rollback(); // performing rollback after commit
if ($transaction->isClosed()) {
echo "No more statements can be added!";
}
Error
Fatal error: Uncaught exception 'Everyman\Neo4j\Exception' with message 'Transaction is already closed' in C:\xampp\htdocs\feed\vendor\everyman\neo4jphp\lib\Everyman\Neo4j\Transaction.php on line 149
But actually this error should be handled by $transaction->isClosed(),but it didin't,
please help, thanks in advance
I tried to use $transaction->isError() and $transaction->isClosed in neo4j transaction, but these functions failed to catch the error. Here is my code, where I did the transaction roll-back after committing, which according to the documentation should produce an error and it should be handled by isClosed(), but it never handled the error rather produced the error.
code
Error
Fatal error: Uncaught exception 'Everyman\Neo4j\Exception' with message 'Transaction is already closed' in C:\xampp\htdocs\feed\vendor\everyman\neo4jphp\lib\Everyman\Neo4j\Transaction.php on line 149
But actually this error should be handled by $transaction->isClosed(),but it didin't, please help, thanks in advance
Link to stackoverflow - http://stackoverflow.com/questions/22118933/transaction-error-handling-not-working-neo4jphp