How can I set up m:n relationships in lithium?

41 views Asked by At

I have 3 tables in my MySQL database:

  • books (id, title)
  • keywords (id, keyword)
  • books_keywords (book_id, keyword_id)

What is the best way to set up models and controllers in li3 to retrieve book titles with their keywords?

1

There are 1 answers

0
Oerd On

li3 only provides one-to-one, one-to-many, and many-to-one relationships. Li3 core developers suggest to avoid many-to-many relationships as they can lead to unexpected problems and are a sign of architectural design of your app.

Have a look at: http://li3.me/docs/book/manual/1.x/models/relationships