title: Unable to retrieve the field column of relation table ActiveDataProvider yii2
body: <p>I have a <code>users</code> table referenced to <code>orders</code> table, so in my <code>Users</code> model, relational method is declared like this:</p>
  
  <pre><code>public function getOrders()
  {
      return $this-&gt;hasMany(Orders::className(), ['user_id' =&gt; 'user_id']);
  }
  </code></pre>
  
  <p>I have a function where I am constructing this query:</p>
  
  <pre><code>$stmt = Users::find()-&gt;select([
      'users.first_name', 'users.last_name',
      'users.user_id', 'orders.payment_method'
  ])-&gt;innerJoinWith('orders');
  </code></pre>
  
  <p>and will pass it to <code>ActiveDataProvider</code>'s <code>query</code> property:</p>
  
  <pre><code>$dataProvider = new ActiveDataProvider([
      'query' =&gt; $stmt,
      'pagination' =&gt; [
          'pageSize' =&gt; self::PER_PAGE,
      ],
  ]);
  </code></pre>
  
  <p>and returns the <code>$dataProvider</code>.</p>
  
  <p>(NOTE: This function lives under a class that extends from <code>yii/rest/Controller</code>, so every function's returning data is expected to be in JSON content.)</p>
  
  <p>However, when I call this function, only the fields of <code>users</code> is returned/selected, and keeps the <code>orders.payment_method</code> missing. This is what i need to get:</p>
  
  <pre><code>[
      {"first_name":"Gold","last_name":"Jacinto","user_id":1521,"payment_method":"CC"},
      {"first_name":"Gold","last_name":"Jacinto","user_id":1521,"payment_method":"COD"}
  ]
  </code></pre>
  
  <p>but getting this output instead:</p>
  
  <pre><code>[
      {"first_name":"Gold","last_name":"Jacinto","user_id":1521},
      {"first_name":"Gold","last_name":"Jacinto","user_id":1521}
  ]
  </code></pre>
  
  <p>Am I missing some process or anything that I should transform into? Any help is greatly appreciated.</p>
  
  <p>Thanks!</p>