Cdbcriteria - Choose Where Operator Between Conditions With Relation

I got the following problem. I Want to show only the taks of a person who have inserted the task itself or is responsible for the task, for this, I have the following database schema:

table Funcionario (table of employees) = id, name, etc…

table TarefasGerais (table of tasks) = id,id_funcionario (who inserted it), etc…

table TarefasResponsaveis (table of responsible employes) = id, id_tarefa (tarefas gerais id), id_funcionario (employee id)

in my model’s search method I did the following:

$criteria->with = array('Responsaveis' => 

    array('condition' => 'Responsaveis.id_funcionario = ' . Yii::app()->user->dados->id));

$criteria->condition = 'id_funcionario_lancamento = ' . Yii::app()->user->dados->id;

but it generates the following SQL:

SELECT COUNT(DISTINCT `t`.`id`) FROM `tbl_tarefas_gerais` `t` LEFT OUTER JOIN `tbl_tarefas_gerais_responsaveis` `Responsaveis` ON

(`Responsaveis`.`id_tarefa` = `t`.`id`) WHERE (id_funcionario_lancamento =

3) AND (Responsaveis.id_funcionario = 3)

as you can see, it uses the "AND" operator, but I need it to use the "OR" operator in the where section.

I tried :

$criteria->with = array('Responsaveis' =>

    array('condition' => 'Responsaveis.id_funcionario = ' . Yii::app()->user->dados->id, 'operator' => 'OR'));

but it didn’t changed anything.

Does anyone have any idea of how to deal with ?

Cheers 0/

Dear Friend

Would you please check the following?

$criteria=new CDbCriteria;


$criteria->addCondition('id_funcionario_lancamento = ' . Yii::app()->user->dados->id);

$criteria->addCondition('Responsaveis.id_funcionario = ' . Yii::app()->user->dados->id,"OR");