每次得到Yii2的存在验证器的错误

时间:2016-12-16 13:41:52

标签: php yii2

以下是我从数据库验证campaign_id的代码 但每次我收到错误天气这个记录都是db或不是

[campaign_id', 'exist', 'targetClass' => '\common\models\Campaign', 'filter' => ['campaign_id' => Campaign::className()], 'message' => 'There is no record with this id.' ]]

1 个答案:

答案 0 :(得分:0)

我得到了解决方案,只是删除了这个过滤器并且它可以正常工作

['campaign_id', 'exist',
            'targetClass' => '\common\models\Campaign',
            'message' => 'There is no user with this email address.'
        ]