public function testUseFkQueryTwiceTwoAliases() { $q = BookQuery::create()->useAuthorQuery('a')->filterByFirstName('Leo')->endUse()->useAuthorQuery('b')->filterByLastName('Tolstoi')->endUse(); $join1 = new ModelJoin(); $join1->setJoinType(Criteria::LEFT_JOIN); $join1->setTableMap(AuthorPeer::getTableMap()); $join1->setRelationMap(BookPeer::getTableMap()->getRelation('Author'), null, 'a'); $join1->setRelationAlias('a'); $join2 = new ModelJoin(); $join2->setJoinType(Criteria::LEFT_JOIN); $join2->setTableMap(AuthorPeer::getTableMap()); $join2->setRelationMap(BookPeer::getTableMap()->getRelation('Author'), null, 'b'); $join2->setRelationAlias('b'); $q1 = BookQuery::create()->addAlias('a', AuthorPeer::TABLE_NAME)->addJoinObject($join1, 'a')->add('a.FIRST_NAME', 'Leo', Criteria::EQUAL)->addAlias('b', AuthorPeer::TABLE_NAME)->addJoinObject($join2, 'b')->add('b.LAST_NAME', 'Tolstoi', Criteria::EQUAL); $this->assertTrue($q->equals($q1), 'useFkQuery() called twice on the same relation with two aliases creates two joins'); }