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', 'user@company.com),
(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?
I ended up creating a table with columns for all properties for performance's sake like so:
PersonId
Name
Phone
Email
Type
With data like so:
1
'John Doe'
'555-55-55'
'user@company.com'
'employee'