Skip to content

Mysql - Fix field trait item types#3713

Merged
bobvandevijver merged 5 commits intobolt:6.1from
shirkalab:field-types-traits
Apr 27, 2026
Merged

Mysql - Fix field trait item types#3713
bobvandevijver merged 5 commits intobolt:6.1from
shirkalab:field-types-traits

Conversation

@kouz75
Copy link
Copy Markdown
Contributor

@kouz75 kouz75 commented Apr 26, 2026

Iterating over a select field on MySQL throws a fatal error

On SQLite, JSON is decoded as strings → current() returns string → no error.
On MySQL, JSON integers are decoded as PHP int → current() returns int
→ type error against the declared Field|string return type.

To reproduce

Content type

homepage:
    name: Homepage
    singular_name: Homepage
    fields:
        related_entry:
            type: select
            values: entries/{title}

Twig
{{dump(record.related_entry)}}

Error
An exception has been thrown during the rendering of a template ("Bolt\Entity\Field\SelectField::current(): Return value must be of type Bolt\Entity\Field|string, int returned") in index.twig at line 10.

@bobvandevijver bobvandevijver changed the base branch from 6.2 to 6.1 April 27, 2026 07:52
@bobvandevijver
Copy link
Copy Markdown
Member

Ah, can you rebase this on 6.1? 6.2 will be for the Vue upgrade, but I needed to make that the main branch to convince dependabot to use that branch for its updates...

@kouz75 kouz75 force-pushed the field-types-traits branch from 536b841 to 5232e2a Compare April 27, 2026 09:53
@bobvandevijver
Copy link
Copy Markdown
Member

@kouz75 Something went wrong with the rebase, can you check that?

@bobvandevijver bobvandevijver merged commit 606ed83 into bolt:6.1 Apr 27, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants