我尝试在 neo4j 事务中使用$transaction->isError()
和$transaction->isClosed
,但这些函数未能捕捉到错误。
下面是我的代码,我在提交后进行了事务回滚,根据文档,它应该会产生错误并且应该由 处理isClosed()
,但它从未处理过错误,而是产生了错误。
代码
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!";
}
错误
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
但实际上这个错误应该由 处理$transaction->isClosed()
,但它没有
请帮忙,提前谢谢