Fixes #2687: ActiveQuery::joinWith() has problem when the query is used twice.