I've got 3 tables
table user with primary key userId
table books with primary key bookId
table userHasBook with primary key the 2 foreign keys userId and bookId. This table has also a boolean field named 'active' which is my main problem
I've created a relation in the books model
With a call like
I can get the books that a user has however my problem is that I want to get all books that a user has as long as the userHasBook.active field is 1 (true) …
Unfortunately I don't have a way to access the 'active' value. Is there a way
to filter the results and get only the ones with userHasBook.active=1 ?
I've tried it by adding in the relation a 'condition'=>'??.active=1' but it results to an error since the query replaces the ?? with the table users and I have a condition where 'users.active=1' and of course mysql says that there is no such column.
Any ideas please ??