Skip to content

Commit

Permalink
create instance field id maybe not first in schema
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaChuvaev authored and nekufa committed Feb 21, 2025
1 parent d1d03cd commit e5517c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Space.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function castIndex(array $fields, bool $optionalIndex = false): ?array

public function create(array $data)
{
if (!array_key_exists('id', $data) && $this->fields[0] == 'id') {
if (!array_key_exists('id', $data) && in_array('id', $this->fields)) {
try {
[$data['id']] = $this->mapper->client->call("box.sequence.$this->name:next");
} catch (RequestFailed $e) {
Expand Down

0 comments on commit e5517c8

Please sign in to comment.