You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-37Lines changed: 38 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,10 +75,47 @@ echo $result; // echos 'z'
75
75
## Decide how to send your Cypher queries
76
76
77
77
You can control the driver using three different approaches:
78
-
-*Transaction functions* (recommended and portable)
79
78
-*Auto committed queries* (easiest and most intuitive)
79
+
-*Transaction functions* (most portable)
80
80
-*Unmanaged transactions* (for the highest degree of control)
81
81
82
+
83
+
### Auto committed queries
84
+
85
+
Auto committed queries are the most straightforward and most intuitive but have many drawbacks when running complex business logic or within a high availability environment.
86
+
87
+
#### Run a simple cypher query
88
+
89
+
```php
90
+
$client->run(
91
+
'MERGE (user {email: $email})', //The query is a required parameter
92
+
['email' => '[email protected]'], //Requests can be optionally added
93
+
'backup' //The default connection can be overridden
The `runStatements` method will run all the statements at once. This method is an essential tool to reduce the number of database calls, especially when using the HTTP protocol.
109
+
110
+
```php
111
+
use Laudis\Neo4j\Databags\Statement;
112
+
113
+
$results = $client->runStatements([
114
+
Statement::create('MATCH (x) RETURN x LIMIT 100'),
Transaction functions are the **de facto** standard when using the driver. It is the most portable as it is resistant to a lot of the pitfalls when first developing with high availability solutions such as [Neo4j aura](https://neo4j.com/blog/neo4j-aura-enterprise-ga-release/) or a [cluster](https://neo4j.com/docs/operations-manual/current/clustering/).
@@ -121,42 +158,6 @@ $client->writeTransaction(static function (TransactionInterface $tsx) use ($id)
121
158
$externalCounter->incrementNodesCreated();
122
159
```
123
160
124
-
### Auto committed queries
125
-
126
-
Auto committed queries are the most straightforward and most intuitive but have many drawbacks when running complex business logic or within a high availability environment.
127
-
128
-
#### Run a simple cypher query
129
-
130
-
```php
131
-
$client->run(
132
-
'MERGE (user {email: $email})', //The query is a required parameter
133
-
['email' => '[email protected]'], //Requests can be optionally added
134
-
'backup' //The default connection can be overridden
The `runStatements` method will run all the statements at once. This method is an essential tool to reduce the number of database calls, especially when using the HTTP protocol.
150
-
151
-
```php
152
-
use Laudis\Neo4j\Databags\Statement;
153
-
154
-
$results = $client->runStatements([
155
-
Statement::create('MATCH (x) RETURN x LIMIT 100'),
If you need lower-level access to the drivers' capabilities, then you want unmanaged transactions. They allow for completely controllable commits and rollbacks.
0 commit comments