Skip to content

Improve enum type class retrieval logic - #7785

Open
Seb33300 wants to merge 1 commit into
EasyCorp:5.xfrom
Seb33300:patch-11
Open

Improve enum type class retrieval logic#7785
Seb33300 wants to merge 1 commit into
EasyCorp:5.xfrom
Seb33300:patch-11

Conversation

@Seb33300

Copy link
Copy Markdown
Contributor

I have a case where I am fetching a non mapped field returning enum.
Because the field is not mapped, enum type can't be retrieved from doctrine.
In that case I have explicitly specified the class option of the form type using ->setFormTypeOption('class', Role::class).

But unfortunately, this option is not supported at the moment. This PR fixes that issue.

I have a case where a non-mapped field returns an enum.

Because the field is not mapped, its enum type cannot be retrieved from Doctrine metadata. In this case, I explicitly specify the class option of the form type using:

->setFormTypeOption('class', Role::class)

However, this option is currently not taken into account when determining the enum type.

This PR fixes the issue by also using the form type's class option to determine the enum type, falling back to Doctrine metadata when necessary.

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.

1 participant