Skip to content
Discussion options

You must be logged in to vote

Select::options() expects an array with two supported structures - 'simple' and groups.
For your case, the 'simple' one suffice.
This one expects the array key to be the value that gets saved to the database, and the array value to be what's supposed to be displayed.
UnitEnum::cases() will hand you a list of the cases, each of which is an instance of the enum.
This is why you're getting the Exception, because PHP doesn't support an enum to be \Stringable (literally - it's forbidden), and you'll need to convert the key/value to the appropriate values.

Off the top of my head, as I write this in the GitHub answer input box, you should be able to do something like

enum StatusEnum: string
{
    

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by crynobone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants