I’m using phpactiverecord for this project, I have this db structure:
Tables: Tickets, Labels
I’m currently using a has_many association for these two tables: “Tickets has many labels”, however I need to assign each label to different ticket, which is not possible at the moment without having duplicated rows with different id and ticket_id values.
Any idea on how to achieve this ?
Cheers
You need create additional table
And update existing AR and create new AR for this table:
Ticket HAS MANY Label2Tickets where Label2Tickets.ticket_id = Tickets.id
Label HAS MANY Label2Tickets where Label2Tickets.label_id = Labels.id