Codeception / Codeception/module-doctrine

Enum Array Support with `simple_array` Type

Đang mở
#6 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
PHP
Star
4
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

It seems that enum arrays are not supported, or am I doing something wrong?

```
/**
* @var FieldType[]
*
* @ORM\Column(type="simple_array", enumType="Demo\FieldType")
*/
private array $supportedFields;
```

I can't use `grabFromRepository()` or `seeInRepository()` as it seems like the module doesn't internally handle the conversion to a comma-delimited string properly. I'm not sure if this issue includes `haveInRepository()` as well since have not tested it.

```
$result = $this->tester->grabEntityFromRepository(Demo::class, [
...
'supportedFields' => [FieldType.Field1, FieldType.Field2, ...] // <-- problematic
]);
```

Crashes with a SyntaxErrorException:

```
Doctrine\DBAL\Exception\SyntaxErrorException : An exception occurred while executing a query: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near ","
LINE 1: ...$1 AND d0_.name = $2 AND d0_.supported_fields = $3, $4, $5, ...
^
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start by locating grabEntityFromRepository(), grabFromRepository(), seeInRepository(), and haveInRepository() in the Doctrine module, then inspect how repository criteria are passed to Doctrine for simple_array fields. Reproduce the failure with the shown enum-array mapping and PostgreSQL setup. Done means the affected helpers handle the array value without generating invalid SQL, with regression coverage for the supported methods.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
php, postgresql
Lĩnh vực
database, testing-qa
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
64/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.