demo icon indicating copy to clipboard operation
demo copied to clipboard

EnumType ?

Open seb-jean opened this issue 2 years ago • 8 comments

Hey :), Would it be cool to propose the EnumType type in PostType? What do you think ?

seb-jean avatar Feb 05 '22 12:02 seb-jean

Do you have a good use case for this? Please, feel free to share

bocharsky-bw avatar Feb 07 '22 10:02 bocharsky-bw

A post status like WordPress ? https://wordpress.org/support/article/post-status/#default-statuses

seb-jean avatar Feb 07 '22 10:02 seb-jean

I'd prefer if we didn't modify code just to use Enums. Given that it's a PHP feature, not a Symfony feature, we are not required to use it if we don't find a good use case for it.

I've looked into code and the only "group of constants" (a good indicator to introduce Enums) is this one: https://github.com/symfony/demo/blob/f1ee7c6b8a70f8fed2ca032052a7760d58299cef/src/Security/PostVoter.php#L31-L33

What do you think? Thanks!

javiereguiluz avatar Feb 07 '22 16:02 javiereguiluz

The idea was to show that EnumType exists.

seb-jean avatar Feb 07 '22 17:02 seb-jean

@javiereguiluz those are constants for the permission attributes, which must be strings, not enums. So they are not a good candidate.

stof avatar May 06 '22 09:05 stof

I close the issue?

seb-jean avatar Dec 14 '22 13:12 seb-jean

Btw, if the goal is to showcase the doctrine/orm feature supporting enums (as suggested by the ticket title, as enumType in the name of the configuration setting for that feature), such use case needs to be found in the data model.

stof avatar Feb 01 '23 13:02 stof

Yes, that's it, that's the goal.

seb-jean avatar Feb 01 '23 13:02 seb-jean