How do you implement a model based off of a database table that has no single column primary key? The table has a composite primary key but no unique column. I want to create a model with this table as its primary table, but as far as I can tell the model requires a unique id field.
The table holds custom field values for services and consists of the following 3 columns: field_id, service_id, value. I need to be able to reference all of the custom field values that exist for a service and also to reference all of the services linked to a particular value.
The two main problems I'm having are..
1) Constructing a model based on the custom fields values table which has no unique column
2) Accomplishing a join with two 'ON' conditions. For example:
services JOIN fields ON
services.id = field.service_id
JOIN values ON
field.id = values.field_id AND
values.service_id = services.id