jeudi 27 juillet 2023

Best approach to define fixed data in Symfony

I need help about how to handle fixed (not changing) data in Symfony, in an API architecture.

Let's say we are doing a dices game, and we want to store the list of dices, each one having a specific range of values (e.g. one having only odd numbers from 1 to 10, another one having only even numbers from 1 to 10, and a last one having all numbers from 1 to 6), and a label.

Creating DB tables to store the different values (e.g. Dice[id,label], DiceValue[id,dice_id,value]) doesn't seem to be the right solution here, so I'd prefer to define these dices in Symfony directly.

My question is how would you define those in Symfony ?
Using a Factory ? Tagged iterators ?
I can't find any resources on the right way to do this kind of things..

Thanks!

Aucun commentaire:

Enregistrer un commentaire