Skip to content

Support for objects in ChoiceField#6862

Open
chapterjason wants to merge 5 commits intoEasyCorp:4.xfrom
chapterjason:patch-1
Open

Support for objects in ChoiceField#6862
chapterjason wants to merge 5 commits intoEasyCorp:4.xfrom
chapterjason:patch-1

Conversation

@chapterjason
Copy link
Copy Markdown
Contributor

@chapterjason chapterjason commented Mar 9, 2025

I currently working on a project which uses the oauth server and clients from league. The server is using values objects for grants, redirect uris and scopes.

Just by using a ChoiceField I got the error:

Uncaught PHP Exception TypeError: "Cannot access offset of type League\Bundle\OAuth2ServerBundle\ValueObject\Grant on array" at ChoiceConfigurator.php line 142 {"exception":"[object] (TypeError(code: 0): Cannot access offset of type League\\Bundle\\OAuth2ServerBundle\\ValueObject\\Grant on array at [...]/vendor/easycorp/easyadmin-bundle/src/Field/Configurator/ChoiceConfigurator.php:142)"} []

This is a simple fix to provide support for any object which implements stringable.

@chapterjason chapterjason changed the title Support for value objects in choices Support for objects in ChoiceField Mar 9, 2025
@chapterjason chapterjason marked this pull request as ready for review March 9, 2025 18:41
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