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
+49-27Lines changed: 49 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -232,27 +232,6 @@ Cypher values and types map to these php types and classes:
232
232
233
233
(*) A point can be one of four types implementing PointInterface: `\Laudis\Neo4j\Types\CartesianPoint``\Laudis\Neo4j\Types\Cartesian3DPoint``\Laudis\Neo4j\Types\WGS84Point``\Laudis\Neo4j\Types\WGS843DPoint`
234
234
235
-
If you want the results to be just a set of rows, columns, arrays and scalar types, you can use a BasicFormatter:
$results = $client->run('MATCH (node:Node) RETURN node, node.id AS id');
245
-
246
-
// A row is a CypherMap
247
-
foreach ($results as $result) {
248
-
// Returns an array of attributes instead of a Node.
249
-
$node = $result->get('node');
250
-
251
-
echo $node['id'];
252
-
echo $result->get('id');
253
-
}
254
-
```
255
-
256
235
## Diving Deeper
257
236
258
237
### Differentiating between parameter type
@@ -264,12 +243,11 @@ The `ParameterHelper` class is the ideal companion for this:
264
243
```php
265
244
use Laudis\Neo4j\ParameterHelper;
266
245
267
-
$client->run('MATCH (x) WHERE x.slug in $listOrMap RETURN x', ['listOrMap' => ParameterHelper::asList([])]); // will return an empty vector
246
+
$client->run('MATCH (x) WHERE x.slug in $listOrMap RETURN x', ['listOrMap' => ParameterHelper::asList([])]); // will return an empty CypherList
268
247
$client->run('MATCH (x) WHERE x.slug in $listOrMap RETURN x', ['listOrMap' => ParameterHelper::asMap([])]); // will error
269
-
$client->run('MATCH (x) WHERE x.slug in $listOrMap RETURN x', ['listOrMap' => []]); // will retrun an empty vector
248
+
$client->run('MATCH (x) WHERE x.slug in $listOrMap RETURN x', ['listOrMap' => []]); // will return an empty CypherList
270
249
```
271
250
272
-
273
251
### Neo4j Version Support
274
252
275
253
|**Version**|**Tested**|
@@ -313,8 +291,8 @@ In order to make the results of the bolt protocol and the http uniform, the driv
313
291
314
292
The default formatter is the `\Laudis\Neo4j\Formatters\OGMFormatter`, which is explained extensively in [the result format section](#accessing-the-results).
315
293
316
-
The driver also provides three formatters by default, which are all found in the Formatter namespace:
317
-
-`\Laudis\Neo4j\Formatter\BasicFormatter` which erases all the Cypher types and simply returns every value in the resulting map as a scalar, null or array value.
294
+
The driver provides three formatters by default, which are all found in the Formatter namespace:
295
+
-`\Laudis\Neo4j\Formatter\BasicFormatter` which erases all the Cypher types and simply returns every value in the resulting map as a [scalar](https://www.php.net/manual/en/function.is-scalar.php), null or array value.
318
296
-`\Laudis\Neo4j\Formatter\OGMFormatter` which maps the cypher types to php types as explained [here](#accessing-the-results).
319
297
-`\Laudis\Neo4j\Formatter\SummarizedResultFormatter` which decorates any formatter and adds an extensive result summary.
320
298
@@ -373,7 +351,7 @@ A **client** manages **drivers** and routes the queries to the correct drivers b
373
351
374
352
### Driver
375
353
376
-
The **driver** object is the thread-safe backbone that gives access to Neo4j. It owns a connection pool and can spawn **sessions** for carrying out work.
354
+
The **driver** object is the thread-safe backbone that gives access to Neo4j. It owns a connection pool and can spawn **sessions** for carrying out work.
377
355
378
356
### Session
379
357
@@ -417,3 +395,47 @@ This library supports three drivers: bolt, HTTP and neo4j. The scheme part of th
417
395
| neo4j | neo4j | neo4j+s | neo4j+ssc | Client side routing over bolt |
418
396
| bolt | bolt | bolt+s | bolt+ssc | Single server over bolt |
419
397
| http | http | https | configured through PSR Client implementation | Single server over HTTP |
398
+
399
+
### Configuration objects
400
+
401
+
A driver, session and transaction can be configured using configuration objects. An overview of the configuration options can be found here:
402
+
403
+
| name | concept | description | class |
404
+
|------|---------|-------------|-------|
405
+
| user agent | driver | The user agent used to identify the client to the neo4j server. |`DriverConfiguration`|
406
+
| Http PSR Bindings | driver | The relevant PSR implementation used by the driver when using the HTTP protocol. |`DriverConfiguration`|
407
+
| database | session | The database to connect to. |`SessionConfiguration`|
408
+
| fetch size | session | The amount of rows to fetch at once. (experimental) |`SessionConfiguration`|
409
+
| access mode | session | The default mode when accessing the server. |`SessionConfiguration`|
410
+
| bookmarks | session | The bookmarks used in the session. (experimental) |`SessionConfiguration`|
411
+
| metadata | transaction | The metadata used during the transaction. (experimental) |`TransactionConfiguration`|
412
+
| timeout | transaction | The maximum amount of time before timing out. |`TransactionConfiguration`|
413
+
414
+
Code Example:
415
+
416
+
```php
417
+
use \Laudis\Neo4j\Databags\DriverConfiguration;
418
+
use Laudis\Neo4j\Databags\SessionConfiguration;
419
+
use Laudis\Neo4j\Databags\TransactionConfiguration;
0 commit comments