title: Yii2 using data from array in query
body: <p>I have this bit of code which finds the ID of the logged in user, finds all of the customers that are related to that user and stores the 'custref'(id) into an array: </p>
  
  <pre><code> $chan = Yii::$app-&gt;user-&gt;identity-&gt;typedIdentity-&gt;getId();
   $cust = Customer::find()-&gt;where(['channelref' =&gt; $chan])-&gt;all();
   foreach($cust as $row){
          $ref[] = $row-&gt;custref;
  
  }
  </code></pre>
  
  <p>I want to use the values in $ref inside of a query, something like this: </p>
  
  <pre><code>$query = $model::findNongeo()-&gt;where(['custref'=&gt;$ref-&gt;custref])-&gt;all();
  </code></pre>
  
  <p>But I have no idea how to do it, I have tried all sorts. Any help would be massively appreciated. </p>