Fixes #1146: Gii generates wrong relation.