Good day! Understanding CActiveRecord
Models As far as I understand, any CActiveRecord
model is a wrapper over a table in the database. The findAll()
method performs a query of the type:
SELECT * FROM `table` `t`
But, in practice, more complex queries are usually needed, which contain links to other tables. For example:
SELECT p.*, c.title FROM post p LEFT JOIN category c ON c.id_cat = p.id_cat
The question is whether it is possible to write such links in the model so that when they call findAll()
they automatically build a complex SQL query.