Skip to content

Commit e0bf160

Browse files
committed
fix for CreateIndex constructor
1 parent 64cecf3 commit e0bf160

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/Models/Request/CreateIndex.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,20 @@
88

99
class CreateIndex implements RequestModel
1010
{
11-
public function __construct(protected string $fieldName, protected ?array $fieldSchema = null)
11+
protected string $fieldName;
12+
protected ?array $fieldSchema;
13+
14+
public function __construct(string $fieldName, array|string $fieldSchema = null)
1215
{
16+
if (is_string($fieldSchema)) {
17+
$this->fieldSchema = [
18+
'type' => $fieldSchema
19+
];
20+
} else {
21+
$this->fieldSchema = $fieldSchema;
22+
}
23+
24+
$this->fieldName = $fieldName;
1325
}
1426

1527
public function toArray(): array

0 commit comments

Comments
 (0)