I have a table which combination of its two fields should be unique. I guess something like
array('field1 field2', 'unique'),
in rules() method may works but it seems not! What can I use instead?
I have a table which combination of its two fields should be unique. I guess something like
array('field1 field2', 'unique'),
in rules() method may works but it seems not! What can I use instead?
Try
array('field1', 'UniqueAttributesValidator', 'with'=>'field2'),
For more information, please visit http://www.yiiframework.com/extension/unique-attributes-validator/