I have been working on a project that deals with, let me simplify, Schools and Students.The general requirement is that certain Students could be assigned to certain Schools to work an internship.But the Schools are not only Schools per se, those can be Hospitals, Prisons, Nursing Homes, etc..Since I'm using an ORM and Entity classes, my first idea was to use Inheritance mapping, like, to have a parent class InternshipProvider with particular child classes...However, another requirement is that this should be done so that any User in future can add the new instance of InternshipProvider by using a form AND at the same time to be able to add some specific properties. Sometimes to the class, and sometimes only to particular instance.Per each instance, the InternshipProvider may have or not, a set of specific properties, which could be available on a form as text fields or choice options, or a subform, etc..So I kinda solved it like this: There is the InternshipProvider class, among standard properties it has a long text property as well. And inside of that text property (field) are JSON key-value pairs, describing those specific fields and values stored.There is also a monster, custom form generator feature, that handles this fairly OK. Each InternshipProvider instance has a specific custom form assigned to it for future editing.There are two reasons for these requirements:They want to eliminate a need for hiring a software developer in future.The domain IS complex and unpredictable.Do you have a better idea? Is there some concept that covers this? Some design pattern or the likes?What would you say to the Client?Thank you
How to design an unpredictable model?
design patterns;object oriented design;domain model;modeling;doctrine
The pattern you are looking for is called EAV or Entity Attribute Value.In this pattern you would set up a table with a row for each attribute and another table with values for each entity x attribute combination.  Values are stored as strings, but you can define meta data in the attribute table to tell the system how to parse the string, e.g. as a date or integer. If you don't have metadata, it makes validation difficult and sorting will come out wrong.EAV isn't always the best in terms of performance, but it will perform much better than a giant JSON string, especially if you need to sort or filter based on these attributes.