I am trying to make the condition that the client identifier must match the client identifier, and the region field in the location table must match the region attached to the location identifier that is associated with the users location.
So I have 3 tables. The current table (t1), the relation table1 refers to (t2) and the table to which t2 refers to the relation2 (let's call it t3).
$ this-> getDbCriteria () -> mergeWith (array (
'with' => $ rel,
'condition' => 'relation1.client_id =: client_id AND
relation1.relation2.region =: region ',
'params' => array (': client_id' => $ client_id, ': region' => $ region),
));
return $ this;
Relation1 is the relation in the table once removed from it. The table to which relation 1 relates, has a relation called relation2, which returns me to where I need to get the value of the region.
If I remove the second condition and parameter, it works, so I know that relation1 works, and relation2 also works in other contexts. Here they are, if they wanted to see them.
public function relations ()
{
return array (
'relation1' => array (self :: BELONGS_TO, 't2', 't2_id'),
);
}
and
public function relations ()
{
return array (
'relation2' => array (self :: BELONGS_TO, 't3', 't3_id'),
);
}
, . ?