What do you use instead of ENUM in Doctrine2? smallint? I thought of using varchar, or explicitly define char, but this may not be very effective when it comes to indexes, or am I wrong?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I usually work with integers mapped to class constants, like
That works quite fine and makes it even easier to work with what you would call ENUMS in an IDE.
You can also use an enumerable type as described by the documentation, but that means you will have to define one custom type per enum column. That’s a lot of work with no real benefit.
You may also want to know why you shouldn’t really use enums.