/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['group_id', 'code', 'name'], 'required'],
[['status', 'created_at', 'updated_at'], 'integer'],
[['group_id', 'code', 'name'], 'string', 'max' => 32],
[['group_id', 'code'], 'unique', 'targetAttribute' => ['group_id', 'code']],
[['group_id', 'name'], 'unique', 'targetAttribute' => ['group_id', 'name']],
];
}
/**
* @inheritdoc
*/
public function rules()
{
$rules = [
];
$parentRules = parent::rules();
return ArrayHelper::merge($rules, $parentRules);
}
{
"code": 20004,
"message": "Data validation failed: The combination \"015ce30b116ce86058fa6ab4fea4ac63\"-\"wxcq\" of Group ID and Code has already been taken."
}
{
"code": 20004,
"message": "数据验证失败:The combination \"015ce30b116ce86058fa6ab4fea4ac63\"-\"wxcq\" of 租户ID and 栏目代码 has already been taken."
}
if (is_array($this->targetAttribute) && count($this->targetAttribute) > 1) {
// fallback for deprecated `comboNotUnique` property - use it as message if is set
if ($this->comboNotUnique === null) {
$this->message = Yii::t('yii', 'The combination {values} of {attributes} has already been taken.');
} else {
$this->message = $this->comboNotUnique;
}
} else {
$this->message = Yii::t('yii', '{attribute} "{value}" has already been taken.');
}


/**
* @inheritdoc
*/
public function rules()
{
$rules = [
[['group_id', 'code'], 'unique', 'targetAttribute' => ['group_id', 'code'], 'message' => Yii::t('app', 'The combination {values} of {attributes} has already been taken.')],
[['group_id', 'name'], 'unique', 'targetAttribute' => ['group_id', 'name'], 'message' => Yii::t('app', 'The combination {values} of {attributes} has already been taken.')],
];
$parentRules = parent::rules();
unset($parentRules[3], $parentRules[4]);
return ArrayHelper::merge($rules, $parentRules);
}
<pre class="wp-block-syntaxhighlighter-code">
<?php
return [
'The combination {values} of {attributes} has already been taken.' => '组合{attributes}的值"{values}"已经被占用了。',
];
</pre>
<pre class="wp-block-syntaxhighlighter-code">
<?php
return [
'The combination {values} of {attributes} has already been taken.' => '组合{attributes}的值"{values}"已经被占用了。',
];
</pre>

{
"code": 20004,
"message": "Data validation failed: The combination \"015ce30b116ce86058fa6ab4fea4ac63\"-\"wxcq\" of Group ID and Code has already been taken."
}
{
"code": 20004,
"message": "数据验证失败:组合租户ID and 栏目代码的值\"\"015ce30b116ce86058fa6ab4fea4ac63\"-\"wxcq\"\"已经被占用了。"
}
PHP / Laravel / Yii2 老项目维护与长期技术支持
如果你的 PHP / Laravel / Yii2 项目已经上线,但遇到原开发离职、Bug 长期无人修复、接口不稳定、性能下降、代码难以接手等问题,可以联系我做一次远程技术排查。
适合以下情况:
✅ 老旧 PHP 系统无人维护
✅ Laravel / Yii2 项目 Bug 修复
✅ 后台管理系统小功能迭代
✅ RESTful API 接口排查
✅ MySQL / Redis / Nginx 性能问题
✅ 长期远程兼职维护
可先从一次小问题开始:
✅ 线上报错排查
✅ 接口异常分析
✅ 慢查询与性能瓶颈定位
✅ 代码结构初步评估
✅ 部署环境与日志检查
如需咨询,请联系我,并注明:PHP 维护咨询。
联系方式:
Telegram:@shuijingwan
微信:13980074657
邮箱:shuijingwanwq@gmail.com

发表回复