neo4j-php-client
neo4j-php-client copied to clipboard
Use bookmarks in basic formatter
Is your feature request related to a problem? Please describe. I simply forgot to implement bookmarks if you use the basic formatter.
Describe the solution you'd like Implement it like the other formatter
Additional context Pointed out by the lovely folks over at issue #139, @stefanak-michal and @wgevaert
Would it be possible to set the return type of FormatterInterface::formatBoltResult
to CypherList
and then put the following code from OGMFormatter
in BoltUnmanagedTransaction
:
$result = new BoltResult(...);
$formattedResult = $this->formatter->formatBoltResult(...,$result,...);
$this->connection->subscribeResult($formattedResult);
$result->addFinishedCallback(function (array $response) {
if (array_key_exists('bookmark', $response) && is_string($response['bookmark'])) {
$this->bookmarkHolder->setBookmark(new Bookmark([$response['bookmark']]));
}
});
return $formattedResult;
or would this do stupid things for e.g. the summarisedresultformatter?
This way, we only use the formatter for actual formatting, and do the other not-strictly-formatter operations outside of the formatter.
EDIT: Or maybe you want the addFinishedCallback
before the formatter?