I am looking for a little advice on database design.
I am constructing a slideshow applicatino on the symfony2 platform, and I have four different types of slideshow containers (company, geo-area, property and individual monitors). This is for the purpose of organizing content and inheriting content down the line (a monitor sits in a property, a property is part of a geoarea etc.).
Now, on flat PHP I would have used only two tables, "containers" and "contents", and put a type field in the containers table defining whether the container in question is a geo-area, property etc. and just linking each content piece (i.e. slide) with a FK to the appropriate container.
Now, learning about symfony2's entity system, it seems that I could gain a lot inheritance-wise by instead defining the different container types as separate entities, thus being able to fetch for instance the geo-area, and automatically get returned all of its child objects (all properties, and in turn all monitors belonging to that property) on the fly. I do however want to be able to switch the "belonging" of a content piece between different containers, and different container types. I sense this will be somewhat hairy with the described approach, seeing there will most likely be a problem with the relation (FK) of the content piece if it must have the capability of "belonging to" any of four different entiy types?
Someone seasoned in the symfony2 world could perhaps enlighten me as to the wisest path to proceed here?
containerthat can be of different type (and has different behaviors) you have a class inheritance issue. For example, you need the classContainerthat has the childsGeoArea, and so on. Then, you need to map the hierarchy to the database: docs.doctrine-project.org/projects/doctrine-orm/en/2.0.x/…