tbl_keyword (id | name)
1 | css
2 | html
3 | javascript
tbl_task_keyword (id_task | id_keyword)
1 | 1
1 | 2
1 | 3
tbl_task (id)
1
if got a many_many relation in my Task Model
'keywordlist' => array(self::MANY_MANY, 'Keyword', 'task_keyword(id_task, id_keyword)'),
now i search for tasks which have the keyword ‘html’.
$criteria->condition = "t.blocked = 0 AND t.answered = 0 AND t.date_deadline > NOW()";
$criteria->order = 't.id desc';
$criteria->with = 'keywordlist';
$criteria->together = true;
$criteria->compare('keywordlist.name', 'html');
$tasks = Task::model()->findAll($criteria);
it finds all the right tasks, but only with the searched keyword. but i want all the other keywords of the task as well. is there a method to say, that check if the keywords of the task is for example ‘html’ return the task and all of its keywords?
the result is:
task (keyword: html)
but i need
task (keyword: html, css, javascript)