Skip to content

Commit 491435f

Browse files
committed
getting index name refactor
1 parent 0e2d3ca commit 491435f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

php/Job/Space/Select.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,17 @@ public function run(): array
6464
}
6565
}
6666

67-
$index_name = $this->getMapper()->find(
68-
'_vindex',
69-
['id' => $space['id'], 'iid' => $this->index]
70-
)[0]['name'];
67+
$index = $this->getMapper()->findOrFail(
68+
'_vindex', [
69+
'id' => $space['id'],
70+
'iid' => $this->index
71+
]
72+
);
73+
74+
$indexName = $index['name'];
7175

7276
[$total] = $this->getMapper()->client->call(
73-
"box.space.$this->space.index.$index_name:count",
77+
"box.space.$this->space.index.$indexName:count",
7478
$key
7579
);
7680
} catch (Exception) {

0 commit comments

Comments
 (0)