I will try to explain what I need but I’m not sure if I can do this since english is not my first language…
I have the following AR classes:
Quote
{
…
public function relations()
{
return array(
'aluno'=>array(self::BELONGS_TO, 'ProcessoSelecaoPessoa', 'id_pess_aluno', 'aliasToken'=>'pessoa'),
'responsavel'=>array(self::BELONGS_TO, 'ProcessoSelecaoPessoa', 'id_pess_resp'),
);
}
…
}
Quote
{
…
}
What I need is to return all the records of ProcessoSelecaoCandidato based on some filters (check this topic) and one of the filter is an attribute of ProcessoSelecaoPessoa, wich is a related class of ProcessoSelecaoCandidato.
I can't use the option 'condition' in relationship declaration because the filter is dynamic.
For example, student name like ‘steve’ and name is an attribute in ProcessoSelecaoPessoa.
My last attempt was trying to use 'aliasToken'=>'pessoa' in relationship declaration and try to get the result like this:
Quote
$criteria->condition = "pessoa.nome LIKE '%$nameFilter%'";
$processoselecaocandidatoList=ProcessoSelecaoCandidato::model()->with('aluno')->findAll($criteria);
But all I get is:
Quote
Does this have a solution?