R
R
Roman2021-02-23 07:35:55
Doctrine ORM
Roman, 2021-02-23 07:35:55

Enum in Symfony (PHP + MySQL) - how to implement it in the most worthy way?

This is a Symfony question, but also in a broader sense - PHP + MySQL - too.

Let's say, in my Essence, the field takes 4 specific values.

The Doctrine website offers a way when a delimiter is written into the setter of this field (string) (it checks if it is in an array of valid values). But the fact is that this method is so-so. For if in a database with 10,000,000 records you need to change the value of any of these fields, the nuances will begin.

On the other hand, putting the keys of the linked table in this field is also not very desirable - for the sake of four enumeration values ​​- to create an entire table))) Although this option is the most correct, of course.

But maybe there is some other solution that I just don't see. As reliable as the second, and more or less simple as the first?

Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question