class Post extends CActiveRecord {
...
}
`
When you list Authors in grid you would like to print the count of posts in column, allow sorting on this column and probably filtering by the count.
class Post extends CActiveRecord {
...
}
`
When you list Authors in grid you would like to print the count of posts in column, allow sorting on this column and probably filtering by the count.
When one needs to select a record in a table that do not have related records through a relation, it is generally suggested to use a subquery. Personnaly, I prefer a high level approach, and I have a method to do it with scopes.