From 7630e93e22d3b34d8510f9e9bc2d2a20dc72ba95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=BE=E5=B1=B1=E8=B2=B4=E5=BA=B7?= Date: Tue, 10 Aug 2021 19:46:05 +0900 Subject: [PATCH] feat: make Nested easier to handle --- src/Colopl/Spanner/Connection.php | 3 ++- src/Colopl/Spanner/Query/Nested.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Colopl/Spanner/Connection.php b/src/Colopl/Spanner/Connection.php index 6ee326ad..509b934a 100644 --- a/src/Colopl/Spanner/Connection.php +++ b/src/Colopl/Spanner/Connection.php @@ -36,6 +36,7 @@ use Google\Cloud\Spanner\Session\SessionPoolInterface; use Google\Cloud\Spanner\SpannerClient; use Google\Cloud\Spanner\Transaction; +use Illuminate\Contracts\Support\Arrayable; use Illuminate\Database\Connection as BaseConnection; use Illuminate\Database\QueryException; use Psr\Cache\CacheItemPoolInterface; @@ -412,7 +413,7 @@ public function prepareBindings(array $bindings) if ($value instanceof DateTimeInterface) { $bindings[$key] = $value->format($grammar->getDateFormat()); } - else if ($value instanceof Nested) { + else if ($value instanceof Arrayable) { $bindings[$key] = $value->toArray(); } } diff --git a/src/Colopl/Spanner/Query/Nested.php b/src/Colopl/Spanner/Query/Nested.php index 644ddece..11bb9744 100644 --- a/src/Colopl/Spanner/Query/Nested.php +++ b/src/Colopl/Spanner/Query/Nested.php @@ -22,7 +22,7 @@ /** * @internal use only for UNNESTing */ -class Nested +class Nested implements Arrayable { /** * @var array