Skip to content

Commit 8c575d9

Browse files
committed
incomplete tuple instance generator fix
1 parent 3e0f4be commit 8c575d9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Space.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Tarantool\Client\Response;
1212
use Tarantool\Client\Schema\Criteria;
1313
use Tarantool\Client\Schema\Operations;
14+
use ValueError;
1415

1516
class Space
1617
{
@@ -233,7 +234,15 @@ public function getInstance(array $tuple)
233234
return $instance;
234235
}
235236

236-
return array_combine($this->fields, $tuple);
237+
try {
238+
return array_combine($this->fields, $tuple);
239+
} catch (ValueError $_) {
240+
$instance = [];
241+
foreach ($this->fields as $n => $field) {
242+
$instance[$field] = array_key_exists($n, $tuple) ? $tuple[$n] : null;
243+
}
244+
return $instance;
245+
}
237246
}
238247

239248
public function getKey($query, ?array $index = null): array

0 commit comments

Comments
 (0)