In Yii 2.0, when the uniqueness verification fails, the prompt is not friendly enough, and the analysis of automatic adjustment and optimization is automatically adjusted.
1. The tester submitted a bug, and when the uniqueness verification fails, the prompt is not friendly enough (Chinese and English are mixed, and the user is not easy to understand), the prompt information is shown in Figure 1
2. In the latest version of the local environment, when it is ready to reappear, all the prompt information of the accidental discovery has been displayed in Chinese, and the prompt information is shown in Figure 2
{
"code": 226004,
"message": "数据验证失败:租户ID, 栏目名称, 是否被删除 与 删除时间 的值 \"\"015ce30b116ce86058fa6ab4fea4ac63\"-\"深圳市9\"-\"0\"-\"0\"\" 已经被占用了。"
}
3. View the corresponding program file, and do not make corresponding adjustments for the prompt information, check the git log, and submit: update yii 2 to the latest version by running composer update, and the yii framework has been changed from Version 2.0.15.1 is upgraded to 2.0.31. It is initially suspected that the prompt information has been adjusted due to the upgrade of the Yii framework version. as shown in Figure 3
4. Deployment label: 1.10.4-alpha.5, for the version before the upgrade, the bug has been reproduced, as shown in Figure 4
{
"code": 226004,
"message": "数据验证失败:The combination \"015ce30b116ce86058fa6ab4fea4ac63\"-\"深圳市1\"-\"0\"-\"0\" of 租户ID, 栏目名称, 是否被删除 and 删除时间 has already been taken."
}
5. Deployment label: 1.10.4-Alpha.6, for the upgraded version, the bug has been fixed, the English has disappeared, the prompt information is more friendly, as shown in Figure 5
{
"code": 226004,
"message": "数据验证失败:租户ID, 栏目名称, 是否被删除 与 删除时间 的值 \"\"015ce30b116ce86058fa6ab4fea4ac63\"-\"深圳市1\"-\"0\"-\"0\"\" 已经被占用了。"
}
6. From this, it is concluded that when the uniqueness verification fails, the reason for being more friendly is that the Yii Framework has been upgraded to 2.0.15.1 from version 2.0.15.1 to 2.0.31. Which version of the period was caused by, look at the github log of /vendor/yiisoft/yii2/messages/en-cn/yii.php . Reference URL:https://github.com/yiisoft/yii2/commit/b8a3fa4ff96cb80d77fcf8003163c9001770ae8b#diff-9083c63f8544587712f4083785a317cf, in Submission: B8A3FA, a new line has been added. Submitted on April 5, 2018, as shown in Figure 6
'The combination {values} of {attributes} has already been taken.' => '{attributes} 的值 "{values}" 已经被占用了。',
7. Reference URL:https://github.com/yiisoft/yii2/tree/2.0.16/framework/messages/zh-CN, commit: B8A3FA exists in Tag: 2.0.16. Therefore, you can determine the 2.0.16 version of the Yii Framework, and the corresponding prompt information has been optimized. as shown in Figure 7






