hello,
so I have the following DB setup:
++++++++++++ +++++++++++++
+ entries + + users +
++++++++++++ +++++++++++++
+ id + + id +
+ userID +--->+ firstname +
+ answerID +--- + lastname +
++++++++++++ | +++++++++++++
|
++++++++++++ |
+ answers + |
++++++++++++ |
+ entryID +<--
+ answer +
++++++++++++
My Entry model [i]relations/i looks like this:
return array(
'user' => array( self::BELONGS_TO, 'User', 'userID' ),
'hasyes'=> array( self::STAT, 'Answer', 'entryID', 'condition' => 'answer="yes"' )
);
What I’m trying to achieve is to display a link (CGridView under admin) if somebody answered at least 1 yes in the answers table, and make that column searchable and sortable.
I found solution for searching in a user table etc, but not for this one.
thanks,
–iM