Store data in an inconvenient table or create a derived table?
- by user1705685
I have a certain predefined database structure that I am stuck with. The question is whether this structure is OK for ORM or I whether should add a processing layer that would create a more convenient structure every time something is inserted into the original DB.
To simplify, here's what it kind of looks like.
I have a person table:
PersonId
Name
And I have a properties table:
PersonId
PropertyType
PropertyValue
So, for person John Doe...
(1, 'John Doe')
...I could have three properties:
(1, 'phone', '555-55-55'),
(1, 'email', '[email protected]),
(1, 'type', 'employee')
By using ORM I would like to get a "person" object that would have properties "name", "phone", "email", "type".
Can Propel do that? How efficient is it? Is it a better idea to create a table with columns "phone", "email", "type" and fill it automatically as new rows are inserted into the properties table?