You should use the use method as described in the document :
$results = FooQuery::create() ->useBarQuery() ->filterBySurname('surname') ->endUse() ->find(); // example Query generated for a MySQL database $query = 'SELECT foo.* from foo INNER JOIN bar ON foo.BAR_ID = bar.ID WHERE bar.SURNAME = :p1'; // :p1 => 'surname'
If you should use join() , I don't think you can use the filterByXXX method, but the old where :
$results = FooQuery::create() ->join('Foo.Bar') ->where('Bar.surname = ?', 'surname') ->find();
source share