Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Alternative solution for #99 #102

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions src/HttpDriver/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public function prepareRequest(Pipeline $pipeline)
$body = json_encode([
'statements' => $statements,
]);

$headers = [
[
'X-Stream' => true,
Expand All @@ -205,16 +206,6 @@ public function prepareRequest(Pipeline $pipeline)

private function formatParams(array $params)
{
foreach ($params as $key => $v) {
if (is_array($v)) {
if (empty($v)) {
$params[$key] = new \stdClass();
} else {
$params[$key] = $this->formatParams($params[$key]);
}
}
}

return $params;
}

Expand Down
24 changes: 24 additions & 0 deletions tests/Issues/Issue99Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace GraphAware\Neo4j\Client\Tests\Issues;

use GraphAware\Neo4j\Client\Tests\Integration\IntegrationTestCase;

/**
* Class Issue99Test
* @package GraphAware\Neo4j\Client\Tests\Issues
*
* @group issue-99
*/
class Issue99Test extends IntegrationTestCase
{
public function testEmptyArrayCanBePassedAsParameter()
{
$q = 'CREATE (n:Person) SET n += {props} RETURN id(n)';
$params = ['props' => ['id' => 123, 'some' => []]];

$result = $this->client->run($q, $params);

$this->assertEquals(1, $result->size());
}
}