I want to define a custom type/status for my entity avoiding to use ENUMS. This field is not fix and new values might came in the future. Also, depends on the current value it has different behaviours (override the implementations of some functions).
My first approach was creating another DB table with all the existing types. This is some kind of ENUM though.
So, my goal is to define a (type?) of my entity and make it modifiable.
Example:
DiningTable.location = terrace ; joinWithTable(..){ //increase guest number }
DiningTable.location = salon ; joinWithTable(..){ //throwException }
New locations might come with different implementations of the joinWithTable().
Aucun commentaire:
Enregistrer un commentaire