title: Yii2: custom validation for multiple attributes using OR not working
body: <p>I am trying to write a rule that validates if attribute_a or attribute_b is set;</p>
  
  <p>one of the following attributes must be set : <code>licitatii_publice</code> or <code>licitatiile_atribuite</code> </p>
  
  <p>The following code does not work;</p>
  
  <pre><code>&lt;?php
  
  namespace common\models;
  
  use yii\base\Model;
  
  class AbonamentValidare extends Model {
  
      public $licitatii_publice;
      public $licitatiile_atribuite;
      public $zone;
      public $judete;
      public $tari;
      public static $targetAttribute = [];
  
      public function rules() {
          return [
              [['zone'], 'required'],
              [['licitatii_publice', 'licitatiile_atribuite', 'tari', 'judete'], 'safe'],
              ['licitatii_publice', 'validate_tip_licitatie', 'targetAttribute' =&gt; ['licitatii_publice', 'licitatiile_atribuite']],
          ];
      }
  
      function validate_tip_licitatie($attribute, $param) {
          print_r($attribute);
          $this-&gt;addError($attribute, 'eroarea');
      }
  
      public function attributeLabels() {
          return array(
              'licitatii_publice' =&gt; 'lp',
              'licitatiile_atribite' =&gt; 'la',
              'tari' =&gt; 'tari',
              'judete' =&gt; 'judete',
              'zone' =&gt; 'zone',
          );
      }
  
      public function save() {
          return false;
      }
  
  }
  
  ?&gt;
  </code></pre>