Fixes #2314: Gii model generator does not generate correct relation type in some special case