I was wondering if it is a good (acceptable) practice to combine those to ways of retrieving/updating database data?
For example, in my database I have two tables (Books
and Users
) and one "many-to-many" table Books_Users
. When a user rates a book, the Books_Users
table should be updated (a new record with a book_id
and a user_id
should be whether inserted or deleted).
I googled ways of doing it using AR methods only, but I haven't found any good solution. I ended up using CDbCommand
execute()
and very simple SQL-query like INSERT INTO books_users(book_id, user_id) VALUES(:bid , :uid);
in a BookController
action.
The point is that all my models extend CActiveRecord
, and I use AR methods all the way.
So here is the question: is that kind of blending of different approaches could be used without remorse, or I should get rid of it immediately and write the code in some "proper way"?