mardi 13 février 2018

Taking action based on list of controllers in database. Or different approach?

So I have this API I'm creating, there is a form where you can choose the type of the next step, those steps are different models and therefore have a different controller. The client is not in the same project.

If I choose Step#1 I'll get a Form#1, if I choose Step#2 I'll get Form#2 and so on. I should be able to change the dropdown entries with the steps so those dropdown entries are in my database. The forms are chosen by the type of controller/model.

I was thinking of doing something like this in my database for the dropdown:

+----+---------------+-----------+
| ID | DropdownTitle | Classname |
+----+---------------+-----------+
|  1 | Type 1        | Class 1   |
|  2 | Type 2        | Class 1   |
|  3 | Type 3        | Class 2   |
|  4 | Type 4        | Class 3   |
+----+---------------+-----------+

As you can see, I need the possibility to assign a class to multiple types.

Now my question is, do I need to use reflection for this, if yes, how do I do that, or it there another better wayto solve this problem?





Aucun commentaire:

Enregistrer un commentaire