File tree Expand file tree Collapse file tree 2 files changed +443
-2
lines changed Expand file tree Collapse file tree 2 files changed +443
-2
lines changed Original file line number Diff line number Diff line change 13
13
14
14
namespace Laudis \Neo4j ;
15
15
16
+ use Bolt \structures \IStructure ;
16
17
use function count ;
17
18
use function gettype ;
18
19
use InvalidArgumentException ;
19
20
use function is_array ;
20
21
use function is_int ;
21
22
use function is_object ;
22
23
use function is_string ;
24
+ use Laudis \Neo4j \Contracts \BoltConvertibleInterface ;
23
25
use Laudis \Neo4j \Types \CypherList ;
24
26
use Laudis \Neo4j \Types \CypherMap ;
25
27
use stdClass ;
@@ -65,12 +67,13 @@ public static function asMap(iterable $iterable): CypherMap
65
67
/**
66
68
* @param mixed $value
67
69
*
68
- * @return iterable|scalar|stdClass|null
70
+ * @return iterable|scalar|stdClass|null|IStructure
69
71
*/
70
- public static function asParameter ($ value )
72
+ public static function asParameter ($ value, bool $ boltDriver = false )
71
73
{
72
74
return self ::cypherMapToStdClass ($ value ) ??
73
75
self ::emptySequenceToArray ($ value ) ??
76
+ self ::convertBoltConvertibles ($ value , $ boltDriver ) ??
74
77
self ::filledIterableToArray ($ value ) ??
75
78
self ::stringAbleToString ($ value ) ??
76
79
self ::filterInvalidType ($ value );
@@ -191,4 +194,13 @@ private static function iterableToArray(iterable $value): array
191
194
192
195
return $ tbr ;
193
196
}
197
+
198
+ private static function convertBoltConvertibles ($ value , bool $ boltDriver ): ?IStructure
199
+ {
200
+ if ($ boltDriver && $ value instanceof BoltConvertibleInterface) {
201
+ return $ value ->convertToBolt ();
202
+ }
203
+
204
+ return null ;
205
+ }
194
206
}
You can’t perform that action at this time.
0 commit comments