Gii crud generator enhancement #2018 fix

This is work on Gii bug #2018. Any comments are welcome!