title: How to set 3 attribute is unique of model
body: <p>I have a model <code>TblPayroll</code> with the above attributes, I want to check uniqueness of <code>'fk_int_emp_id'</code> , <code>'fk_int_payroll_month'</code>, <code>'fk_int_payroll_year'</code>. If this three fields already in database it should not insert. At least one is different it should insert. How can I check the uniqueness?   </p>
  
  <pre><code>public function attributeLabels()
      {
          return [
              'pk_int_payroll_id' =&gt; 'Payroll Id',
              'fk_int_emp_id' =&gt; 'Employee',
              'vchr_worked_hours' =&gt; 'Worked Hours',
              'vchr_actual_hours' =&gt; 'Actual Hours',
              'fk_int_payroll_month' =&gt; 'Month',
              'fk_int_payroll_year' =&gt; 'Year',
          ];
      }
  
  public function rules()
      {
          return [
              [[ 'vchr_worked_hours', 'vchr_actual_hours', 'fk_int_payroll_month', 'fk_int_payroll_year'], 'required'],
  
              //[['fk_int_emp_id', 'fk_int_payroll_year','vchr_worked_hours','vchr_actual_hours'], 'integer'],
              //[['fk_int_emp_id','fk_int_payroll_month','fk_int_payroll_year'], 'string', 'max' =&gt; 50],
              [['fk_int_emp_id'], 'exist', 'skipOnError' =&gt; true, 'targetClass' =&gt; TblEmployee::className(), 'targetAttribute' =&gt; ['fk_int_emp_id' =&gt; 'pk_int_emp_id']],
              [['fk_int_payroll_month'], 'exist', 'skipOnError' =&gt; true, 'targetClass' =&gt; TblPayrollMonth::className(), 'targetAttribute' =&gt; ['fk_int_payroll_month' =&gt; 'pk_int_payroll_month_id']],
              [['fk_int_payroll_year'], 'exist', 'skipOnError' =&gt; true, 'targetClass' =&gt; TblPayrollYear::className(), 'targetAttribute' =&gt; ['fk_int_payroll_year' =&gt; 'pk_int_payroll_year_id']],
          ];
      }
  </code></pre>