Skip to content

Commit

Permalink
Merge pull request #49 from ulobby/add-size-option
Browse files Browse the repository at this point in the history
Add size option
  • Loading branch information
joseraul authored Mar 14, 2022
2 parents a75d645 + d8dca38 commit 9fc4152
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"illuminate/events": "^8.0",
"illuminate/console": "^8.0",
"nesbot/carbon": "^2.0",
"laudis/neo4j-php-client": "^2.4"
"laudis/neo4j-php-client": "^2.4",
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "^9.3.3",
Expand Down
5 changes: 5 additions & 0 deletions src/DatabaseDriver/Drivers/ClientAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public function getTimeout()
return $this->getConfig('default_timeout');
}

public function getFetchSize()
{
return $this->getConfig('fetch_size');
}

/**
* Get the connection port.
*
Expand Down
5 changes: 4 additions & 1 deletion src/DatabaseDriver/Drivers/Laudis/Laudis.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Laudis\Neo4j\Client;
use Laudis\Neo4j\ClientBuilder;
use Laudis\Neo4j\Contracts\AuthenticateInterface;
use Laudis\Neo4j\Databags\SessionConfiguration;
use Laudis\Neo4j\Databags\Statement;
use Laudis\Neo4j\Databags\TransactionConfiguration;
use Laudis\Neo4j\Formatter\OGMFormatter;
Expand All @@ -28,11 +29,13 @@ public function __construct($config)
$this->config = $config;
$formatter = new SummarizedResultFormatter(OGMFormatter::create());

$timeout = (float) $this->getTimeout() ?? TransactionConfiguration::DEFAULT_TIMEOUT;
$timeout = (float) ($this->getTimeout() ?? TransactionConfiguration::DEFAULT_TIMEOUT);
$fetchSize = (int) ($this->getFetchSize() ?? SessionConfiguration::DEFAULT_FETCH_SIZE);

$client = ClientBuilder::create()
->withDriver('default', $this->buildUriFromConfig($config), $this->getAuth())
->withDefaultTransactionConfiguration(TransactionConfiguration::default()->withTimeout($timeout))
->withDefaultSessionConfiguration(SessionConfiguration::default()->withFetchSize($fetchSize))
->withFormatter($formatter)
->build();

Expand Down

0 comments on commit 9fc4152

Please sign in to comment.