How I can write the query
SELECT *
FROM doc_docs dd
JOIN doc_access da
ON dd.id=da.doc_id
AND da.user_id=7
with CDbCriteria
syntax?
How I can write the query
SELECT *
FROM doc_docs dd
JOIN doc_access da
ON dd.id=da.doc_id
AND da.user_id=7
with CDbCriteria
syntax?
You actually cant completely write that since you have to apply the criteria to an activerecord model to obtain the primary table, but assuming you have a DocDocs model you can do it like this:
Although it might be a lot easier if you give your DocDocs model a relation with doc_access, then you don't have to use the dbcriteria:
Should give you a fairly good idea how to start...