Skip to content

Commit ea1608c

Browse files
committed
upgrade to cypher datastructures 0.2.0 wip
1 parent fcbdf47 commit ea1608c

File tree

9 files changed

+108
-74
lines changed

9 files changed

+108
-74
lines changed

.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+
```

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

docs/usage.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ $em = $container->get(EntityManagerInterface::class);
5050

5151
$node = new Node();
5252
$node
53-
->addProperty(new PropertyName('id'), 1234)
54-
->addIdentifier(new PropertyName('id'));
53+
->addProperty('id', 1234)
54+
->addIdentifier('id');
5555

5656
$em->create($node);
5757
$em->flush();
@@ -69,9 +69,9 @@ $em = $container->get(EntityManagerInterface::class);
6969

7070
$node = new Node();
7171
$node
72-
->addProperty(new PropertyName('id'), 1234)
73-
->addProperty(new PropertyName('newProperty'), ':D')
74-
->addIdentifier(new PropertyName('id'));
72+
->addProperty('id', 1234)
73+
->addProperty('newProperty', ':D')
74+
->addIdentifier('id');
7575

7676
$em->merge($node);
7777
$em->flush();
@@ -89,8 +89,8 @@ $em = $container->get(EntityManagerInterface::class);
8989

9090
$node = new Node();
9191
$node
92-
->addProperty(new PropertyName('id'), 1234)
93-
->addIdentifier(new PropertyName('id'));
92+
->addProperty('id', 1234)
93+
->addIdentifier('id');
9494

9595
$em->delete($node);
9696
$em->flush();

0 commit comments

Comments
 (0)