title: Yii2 model rules, how to use another table whilst using exist?
body: <p>I want to check if the categoryid given is an existing category. I've tried several values as the target attribute, but I can't get it working so far.</p>
  
  <p>When I execute the query as is, it returns the correct value for what I am trying to add.</p>
  
  <pre><code>public function rules()
  {
      return [
          [['categoryid'], 'integer'],    
          ['categoryid', 'exist', 'targetAttribute' =&gt; FaqCategory::findOne(['id=:id', ['id'=&gt;'categoryid']])['id']],
          [['question', 'answer'], 'required'],
          [['answer'], 'string'],
          [['question'], 'string', 'max' =&gt; 255]
      ];
  }
  </code></pre>
  
  <ul>
  <li>Update</li>
  </ul>
  
  <p>I stumbled upon targetClass. However this time around I receive Class 'FaqCategory' not found. Class is to be found under the same namespace.</p>
  
  <pre><code> ['categoryid', 'exist', 'targetClass' =&gt; 'FaqCategory'] 
  </code></pre>