title: How to concat 2 columns from different tables on Yii2
body: <p>I'm trying to rewrite my query in a smart mode, using the facilities of Yii2.</p>
  
  <p><strong>The original and working method is:</strong></p>
  
  <pre><code>public function getApartamentos() {
       $query = Apartamento::findBySql('select apartamento.id as id, CONCAT(apartamento.numero, \' \', torre.sigla, \' (\', torre.nome,
   \')\') as numero_completo from apartamento left join torre on
   apartamento.torre_fk = torre.id') ;
       return ArrayHelper::map($query-&gt;asArray()-&gt;all(),'id','numero_completo'); 
  }
  </code></pre>
  
  <p><strong>So, i'm trying to transform the method above on:</strong></p>
  
  <pre><code>public function getApartamentos() {   
       $query = Apartamento::find()
              -&gt;joinWith('torreFk')
              -&gt;select(['apid'=&gt;'apartamento.id','numeroap'=&gt;'CONCAT(apartamento.numero,
   \' \', torre.sigla, \' (\', torre.nome, \')\')']);
       return ArrayHelper::map($query-&gt;asArray()-&gt;all(),'apid','numeroap'); 
  }
  </code></pre>
  
  <p><strong>But, when i do it, i get some errors:</strong></p>
  
  <pre><code>PHP Notice – yii\base\ErrorException
  Undefined index: id
  in &lt;?=$form-&gt;field($model, 'apartamento_fk')-&gt;dropDownList(Apartamento::getApartamentos()) ?&gt;
  </code></pre>
  
  <p>Can anyone help me? Thanks!</p>