Opening Models with enums and other resources gives this errors
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Mở src/Factories/AttributeItem.php và kiểm tra getValues(), đặc biệt là cách kết quả của SHOW COLUMNS được phân tích cho các giá trị enum. Tái hiện trường hợp model enum hoặc resource trên thiết lập SingleStore được báo cáo, sau đó xác minh rằng việc mở model không còn gây ra lỗi khóa mảng chưa được định nghĩa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
OS: darwin
Invoker Version: 2.13.2
Laravel Version: 9.52.16
Local project: true
PHP Binary: /opt/local/bin/php
Route: /project/index?class=App%5CProject&time=1699447934372&project=local-pRqsxUxr4R3JiW2v2nbauD
Error:
ErrorException
Undefined array key 1
at phar:/Applications/Invoker.app/Contents/Resources/invoker.phar/src/Factories/AttributeItem.php:39
35▕ public static function getValues(\Illuminate\Database\Eloquent\Model $model, $column)
36▕ {
37▕ $type = $model->getConnection()->select("SHOW COLUMNS FROM `{$model->getTable()}` WHERE Field = '{$column->getName()}'")[0]->Type;
38▕ \preg_match("/^enum\\(\\'(.*)\\'\\)\$/", $type, $matches);
➜ 39▕ $values = \explode("','", $matches[1]);
40▕ return $values;
41▕ }
42▕ public static function getCastFromColumn(\Illuminate\Database\Eloquent\Model $model, $column) : ?string
43▕ {
1 phar:/Applications/Invoker.app/Contents/Resources/invoker.phar/src/Factories/AttributeItem.php:39
Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap\{closure}("Undefined array key 1", "phar:///Applications/Invoker.app/Contents/Resources/invoker.phar/src/Factories/AttributeItem.php")
2 phar:/Applications/Invoker.app/Contents/Resources/invoker.phar/src/Factories/AttributeItem.php:25
_HumbugBoxeb1c6394dc9c\Invoker\Factories\AttributeItem::getValues(Object(App\Project), Object(Doctrine\DBAL\Schema\Column))
Probably the reason this is broken is because the query isn't working completely on SingleStore.
The fix is fairly easy in src/Factories/AttributeItem.php
@@ -34,7 +34,7 @@
}
public static function getValues(\Illuminate\Database\Eloquent\Model $model, $column)
{
+ $type = $model->getConnection()->select("SHOW COLUMNS FROM `{$model->getTable()}` LIKE '{$column->getName()}'")[0]->Type;
- $type = $model->getConnection()->select("SHOW COLUMNS FROM `{$model->getTable()}` WHERE Field = '{$column->getName()}'")[0]->Type;
\preg_match("/^enum\\(\\'(.*)\\'\\)\$/", $type, $matches);
$values = \explode("','", $matches[1]);
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 76
- Fork
- 1
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của beyondcode/invoker-community
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
beyondcode/invoker-community#400 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
beyondcode/invoker-community#399 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
beyondcode/invoker-community#398 ·
-
feature request
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
beyondcode/invoker-community#397 ·
-
Invoker issueĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
beyondcode/invoker-community#396 ·
Tất cả issue của beyondcode/invoker-community
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
ranxianglei/billion-context#4720 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
melgarafael/DeskcommCRM#3421 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Xiaomi Mimo语音识别服务异常Đang mởpending triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
c1overzz/dsh-bili-scroll#124 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug doc-audit
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày