Skip to content

Commit 0b99e39

Browse files
authored
Merge pull request #2 from Syndesi/feature/upgrade-to-cypher-datastructures-0.2.0
Feature/upgrade to cypher datastructures 0.2.0
2 parents 2c0025e + ea1608c commit 0b99e39

File tree

177 files changed

+3320
-1957
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+3320
-1957
lines changed

.github/workflows/ci-unit-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php-version: ['8.1']
17-
neo4j-version: ['4.4', '5.1.0']
16+
php-version: ['8.1', '8.2-rc']
17+
neo4j-version: ['4.4', '5.1.0', '5.2.0']
1818
env:
1919
ENABLE_FEATURE_TEST: true
2020
NEO4J_VERSION: ${{ matrix.neo4j-version }}
@@ -38,7 +38,7 @@ jobs:
3838
with:
3939
php-version: ${{ matrix.php-version }}
4040
tools: composer:v2
41-
- run: composer install
41+
- run: composer install --ignore-platform-reqs
4242
shell: bash
4343
- run: composer test
4444
shell: bash

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77
.phpunit.result.cache
88
composer.lock
99
coverage.xml
10-
infection.html
10+
infection.html
11+
/docs/.npm
12+
/docs/.config

Readme.md

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,53 @@
1717

1818
# Syndesi's Cypher Entity Manager
1919

20-
This library provides an entity manager for Cypher data types.
21-
22-
Links:
20+
This library provides an entity manager for Cypher data types.
21+
This basically means, that you do not have to write create/merge/delete statements for your nodes, relations etc. per
22+
hand. Instead, you just call `$em->create($node)`, `$em->merge($node)`, `$em->delete($node)` and at the end
23+
`$em->flush()`.
2324

2425
- [Documentation](https://neo4j-php.github.io/cypher-entity-manager)
2526
- [Packagist](https://packagist.org/packages/syndesi/cypher-entity-manager)
26-
- [Neo4j PHP Community](https://github.com/neo4j-php)
27+
28+
## Installation
29+
30+
To install this library, run the following code:
31+
32+
```bash
33+
composer require syndesi/cypher-entity-manager
34+
```
35+
36+
This is all, now you can use the library :D
37+
38+
## Using the library
39+
40+
```php
41+
use Syndesi\CypherDataStructures\Type\Node;
42+
use Syndesi\CypherEntityManager\Type\EntityManager;
43+
44+
/**
45+
* note: the container should be provided by your framework. manual configuration is possible, see documentation
46+
* @var EntityManagerInterface $em
47+
*/
48+
$em = $container->get(EntityManager::class);
49+
50+
$node = new Node();
51+
$node
52+
->addLabel('NodeLabel')
53+
->addIdentifier('id', 123)
54+
->addProperty('someProperty', 'someValue')
55+
->addIdentifier('id');
56+
57+
// create a node:
58+
$em->create($node);
59+
$em->flush();
60+
61+
// update a node:
62+
$node->addProperty('newProperty', 'Hello world :D');
63+
$em->merge($node);
64+
$em->flush();
65+
66+
// delete a node:
67+
$em->delete($node);
68+
$em->flush();
69+
```

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
],
2020
"require": {
2121
"php": "^8.1",
22-
"syndesi/cypher-data-structures": "^0.1.3",
23-
"laudis/neo4j-php-client": "^2.7",
22+
"syndesi/cypher-data-structures": "^0.2.0",
23+
"laudis/neo4j-php-client": "^2.8",
2424
"psr/log": "^3.0",
2525
"psr/event-dispatcher": "^1.0"
2626
},
@@ -53,6 +53,7 @@
5353
},
5454
"scripts": {
5555
"test": "export ENABLE_FEATURE_TEST=true && echo -n \"\" > ./tests/test.log && php vendor/phpunit/phpunit/phpunit",
56+
"test:current": "export ENABLE_FEATURE_TEST=true && echo -n \"\" > ./tests/test.log && php vendor/phpunit/phpunit/phpunit --group current",
5657
"test:coverage:xml": "export XDEBUG_MODE=coverage && php ./vendor/phpunit/phpunit/phpunit --coverage-clover coverage.xml",
5758
"test:coverage:html": "export XDEBUG_MODE=coverage && php ./vendor/phpunit/phpunit/phpunit --coverage-html ./tmp",
5859
"test:mutant": "export XDEBUG_MODE=coverage && php vendor/infection/infection/bin/infection --threads=4",

docs/README.md

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,53 @@
1717

1818
# Syndesi's Cypher Entity Manager
1919

20-
This library provides an entity manager for Cypher data types.
21-
22-
Links:
20+
This library provides an entity manager for Cypher data types.
21+
This basically means, that you do not have to write create/merge/delete statements for your nodes, relations etc. per
22+
hand. Instead, you just call `$em->create($node)`, `$em->merge($node)`, `$em->delete($node)` and at the end
23+
`$em->flush()`.
2324

2425
- [Documentation](https://neo4j-php.github.io/cypher-entity-manager)
2526
- [Packagist](https://packagist.org/packages/syndesi/cypher-entity-manager)
26-
- [Neo4j PHP Community](https://github.com/neo4j-php)
27+
28+
## Installation
29+
30+
To install this library, run the following code:
31+
32+
```bash
33+
composer require syndesi/cypher-entity-manager
34+
```
35+
36+
This is all, now you can use the library :D
37+
38+
## Using the library
39+
40+
```php
41+
use Syndesi\CypherDataStructures\Type\Node;
42+
use Syndesi\CypherEntityManager\Type\EntityManager;
43+
44+
/**
45+
* note: the container should be provided by your framework. manual configuration is possible, see documentation
46+
* @var EntityManagerInterface $em
47+
*/
48+
$em = $container->get(EntityManager::class);
49+
50+
$node = new Node();
51+
$node
52+
->addLabel('NodeLabel')
53+
->addIdentifier('id', 123)
54+
->addProperty('someProperty', 'someValue')
55+
->addIdentifier('id');
56+
57+
// create a node:
58+
$em->create($node);
59+
$em->flush();
60+
61+
// update a node:
62+
$node->addProperty('newProperty', 'Hello world :D');
63+
$em->merge($node);
64+
$em->flush();
65+
66+
// delete a node:
67+
$em->delete($node);
68+
$em->flush();
69+
```

docs/_navbar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
- [GitHub](https://github.com/Syndesi/cypher-entity-manager)
1+
- [GitHub](https://github.com/neo4j-php/cypher-entity-manager)
22
- [Packagist](https://packagist.org/packages/syndesi/cypher-entity-manager)

docs/_sidebar.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
- [Home](/)
2-
- [Getting Started](/getting_started.md)
32
- [Usage](/usage.md)
43
- [Todo](/todo.md)
54
- [Credits & License](/credits_and_license.md)

docs/credits_and_license.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ for helping to refine this library! :D
1111
- The favicon is a modified form of the icons `chart-bubble` and `cog` from
1212
[Material Design Icons](https://materialdesignicons.com/), published under the Apache 2.0 license.
1313
- This documentation uses the same blue as Neo4j's logo, which was not vetoed by Neo4j.
14+
- Core aspects of this library are inspired by [Doctrine](https://www.doctrine-project.org/), an entity manager for SQL
15+
databases.
1416

1517
## Dedication
1618

docs/getting_started.md

Lines changed: 0 additions & 53 deletions
This file was deleted.

docs/todo.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77
- Create framework bridges:
88
- Symfony
99
- Laravel
10-
- Add support for other graph databases:
11-
- Memgraph
1210

1311
## Other
1412

1513
- Add trigger/notification for newly released Neo4j versions?
16-
- Test with PHP 8.2 once it is released
1714

1815
## Possible bugs
1916

2017
- merge relations with no properties beside identifiers: does it work?
18+
- support cypher data structure elements with bad practice properties/labels/types

0 commit comments

Comments
 (0)