Skip to content

Commit 8f794ed

Browse files
committed
optional index casting
1 parent c3e28ba commit 8f794ed

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Space.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function addProperty(string $name, string $type, array $config = [])
8787
}
8888
}
8989

90-
public function castIndex(array $fields): ?array
90+
public function castIndex(array $fields, bool $optionalIndex = false): ?array
9191
{
9292
foreach ($this->indexes as $index) {
9393
if ($index['fields'] == $fields) {
@@ -117,6 +117,10 @@ public function castIndex(array $fields): ?array
117117
}
118118
}
119119

120+
if ($optionalIndex) {
121+
return null;
122+
}
123+
120124
throw new Exception("Index casting failure");
121125
}
122126

0 commit comments

Comments
 (0)