模型中设置场景规则无效的说明
在model中设置rule规则
['code','unique','on'=>['create','update']],
此规则在指定场景中起作用
那么在controller中需要使用
$_modelD->setScenario('create');
才能生效,而使用
$_modelD->scenario('create');//无效
在model中设置rule规则
['code','unique','on'=>['create','update']],
此规则在指定场景中起作用
那么在controller中需要使用
$_modelD->setScenario('create');
才能生效,而使用
$_modelD->scenario('create');//无效
No comments to display
No comments to display