Skip to content
Merged
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
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PHP_VERSION
ARG PHP_VERSION=8.1

FROM php:${PHP_VERSION}-cli
RUN apt-get update \
Expand All @@ -8,9 +8,6 @@ RUN apt-get update \
git \
wget \
&& docker-php-ext-install -j$(nproc) bcmath sockets \
&& wget https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 \
&& mv test-reporter-latest-linux-amd64 /usr/bin/cc-test-reporter \
&& chmod +x /usr/bin/cc-test-reporter \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile.neo4j-okta
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM neo4j:5-enterprise

COPY ./neo4j-with-okta.conf /var/lib/neo4j/conf/neo4j.conf
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ services:
- .env
neo4j:
<<: *common
image: neo4j:5.23-community
image: neo4j:5.23-enterprise
hostname: neo4j
networks:
- neo4j
Expand All @@ -62,6 +62,7 @@ services:
- "11474:7474"
environment:
<<: *common-env
NEO4J_ACCEPT_LICENSE_AGREEMENT: 'yes' # Also add this
NEO4J_server_bolt_advertised__address: neo4j:7687
NEO4J_server_http_advertised__address: neo4j:7474

Expand Down
829 changes: 829 additions & 0 deletions neo4j-with-okta.conf

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions src/Exception/SSLConnectionException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Neo4j PHP Client and Driver package.
*
* (c) Nagels <https://nagels.tech>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Laudis\Neo4j\Exception;

use RuntimeException;

final class SSLConnectionException extends RuntimeException
{
}
20 changes: 20 additions & 0 deletions src/Exception/TimeoutException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Neo4j PHP Client and Driver package.
*
* (c) Nagels <https://nagels.tech>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Laudis\Neo4j\Exception;

use RuntimeException;

class TimeoutException extends RuntimeException
{
}
7 changes: 6 additions & 1 deletion src/Formatter/Specialised/BoltOGMTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ private function makeFromBoltRelationship(BoltRelationship $rel): Relationship
foreach ($rel->properties as $key => $property) {
$map[$key] = $this->mapValueToType($property);
}
/** @var string|null $elementId */
$startNodeElementId = null;
$endNodeElementId = null;

/** @var string|null $elementId */
$elementId = null;
Expand All @@ -191,7 +194,9 @@ private function makeFromBoltRelationship(BoltRelationship $rel): Relationship
$rel->endNodeId,
$rel->type,
new CypherMap($map),
$elementId
$elementId,
$startNodeElementId, // Add this parameter
$endNodeElementId
);
}

Expand Down
12 changes: 12 additions & 0 deletions src/Types/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
*/
final class Relationship extends UnboundRelationship
{
private string $startNodeElementId;
private string $endNodeElementId;

/**
* @param CypherMap<OGMTypes> $properties
*/
Expand All @@ -34,8 +37,17 @@ public function __construct(
string $type,
CypherMap $properties,
?string $elementId,
int|string|null $startNodeElementId = null,
int|string|null $endNodeElementId = null,
) {
parent::__construct($id, $type, $properties, $elementId);
$this->startNodeElementId = $startNodeElementId !== null
? (string) $startNodeElementId
: (string) $startNodeId;

$this->endNodeElementId = $endNodeElementId !== null
? (string) $endNodeElementId
: (string) $endNodeId;
}

/**
Expand Down
14 changes: 12 additions & 2 deletions src/Types/UnboundRelationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ class UnboundRelationship extends AbstractPropertyObject
/**
* @param CypherMap<OGMTypes> $properties
*/
private string $elementId;

public function __construct(
private readonly int $id,
private readonly string $type,
private readonly CypherMap $properties,
private readonly ?string $elementId,
?string $elementId = null,
) {
$this->elementId = $elementId ?? (string) $id;
}

public function getElementId(): ?string
Expand All @@ -55,6 +58,9 @@ public function getType(): string
return $this->type;
}

/**
* @psalm-suppress MixedReturnTypeCoercion
*/
public function getProperties(): CypherMap
{
/** @psalm-suppress InvalidReturnStatement false positive with type alias. */
Expand All @@ -80,7 +86,11 @@ public function toArray(): array
*
* @return OGMTypes
*/
public function getProperty(string $key)

/**
* @psalm-suppress MixedReturnStatement
*/
public function getProperty(string $key): string
{
/** @psalm-suppress ImpureMethodCall */
if (!$this->properties->hasKey($key)) {
Expand Down
20 changes: 20 additions & 0 deletions test-basic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
require_once 'vendor/autoload.php';

use Laudis\Neo4j\ClientBuilder;
use Laudis\Neo4j\Authentication\Authenticate;

$client = ClientBuilder::create()
->withDriver('bolt', 'bolt://localhost:7687',
Authenticate::basic('neo4j', 'testtest')
)
->build();

try {
$result = $client->run('RETURN "Hello World" as message');
echo "Connection successful!\n";
print_r($result->first()->get('message'));
} catch (Exception $e) {
echo "Connection failed: " . $e->getMessage() . "\n";
}
?>
4 changes: 4 additions & 0 deletions testkit-backend.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

docker compose up -d testkit_backend
docker compose logs -f testkit_backend
Empty file added testkit-backend/bookmarkHolder
Empty file.
Empty file added testkit-backend/bookmarkHolder,
Empty file.
Empty file added testkit-backend/connection,
Empty file.
Empty file added testkit-backend/database,
Empty file.
Loading