I would like to create validate unique more columns
example
id firstname lastname
1 foo foo
2 foo test
3 test test
but
insert foo , foo result validate duplication
(sorry I am not good englist
I would like to create validate unique more columns
example
id firstname lastname
1 foo foo
2 foo test
3 test test
but
insert foo , foo result validate duplication
(sorry I am not good englist
use unique validator for that
read here more http://www.yiiframework.com/doc/guide/1.1/en/form.model#declaring-validation-rules also there is in wiki article about it
try adding below to model ruels
array('firstname','unique','message'=>'Firstname {value} already in use!'),
this won’t work if not used from CActiveRecord…
for CFormModel it has additional parameters…
best look in wiki, there is very good article with all parameters available for every built in validation
I found link http://www.yiiframework.com/extension/unique-multiple-columns-validate/ ,I would like result same extentsion , but I would like CActiveRecord , Do this ?
array(‘firstname+lastname’,‘unique’,‘message’=>‘Firstname {value} already in use!’),