In my application the user has to choose several formselects and these return an INT (after jugling). I want to save this INT in the database. For example province in one of my forms:
$this->add([
'name' => 'provincie',
'type' => Select::class,
'options' => [
'label' => 'Provincie',
'empty_option' => 'Kies uw provincie',
'value_options' => [
1 => 'Friesland',
2 => 'Groningen',
3 => 'Drenthe',
4 => 'Overijsel',
5 => 'Flevoland',
6 => 'Gelderland',
7 => 'Utrecht',
8 => 'Noord-Holland',
9 => 'Zuid-Holland',
10 => 'Zeeland',
11 => 'Noord-Braband',
12 => 'Limburg'
],
],
]);
But if I have to display the user (after a database select) then obviously not the INT should be shown, but the associated name (string).
Is it better to use a mapping table or an array based on which the INT can be mapped with the string (and can also be used in the selects).
Iām leaning towards the array but where to store it as it is used throughout the application. Is global.php the place? And if so, how to get this array into a model or controller?