My application has many different status types, which I need to reference many different times. I’d like to figure out how to use these lists without querying a table in the database.
Here’s an example:
Customer Status
- Prospect
- Pending
- Active
- Inactive
- Abandoned
This list of Customer Statuses may be referenced in dropdown lists, filters, and tables.
I can think of two options I don’t want to do:
-
Create a customer_status_types table in the db and query this table every time I need to display the options - bad because unnecessary db hits
-
Type the static list of options in every dropdown and filter (basically every time it’s used) - bad because it can’t be edited at once, more opportunities for typos, etc
How can I write this list once, save it, and reference it throughout the application? Would I use an array?
Thanks!
Last updated: