title: yii gridview filter with external api and one to many
body: <p>I am struggling with gridview filter. In my code I have two getters.</p>
  <pre><code>public function getPhone()
  {
      return UserPhone::find()-&gt;where(['user_id' =&gt; $this-&gt;id])-&gt;orderBy('updated_at DESC')-&gt;one();
  }
  
  public function getDevice()
  {
      return ExternalAPiHelper::getDeviceInfo($this-&gt;id); // this will make a call to external db, and fetching result from there.
  }
  </code></pre>
  <p>I am trying to do a filter for <code>$user-&gt;phone-&gt;country</code> and <code>$user-&gt;device-&gt;type</code> I am not sure how I can get the results from both of these in a clean manner. Currently, I am fetching the id from the above 2 and then using the result array in <code>$query-&gt;where(['in', 'id', $ids]);</code></p>
  <p>Is there any better way to do this?</p>