Ensure that the table prefix is used when generating the class name.

Fix to https://github.com/yiisoft/yii2/issues/2096

The verification of the first pattern will always be true and the pattern with the prefix will never be tested.