title: Yii2 DropDownList with full names
body: <p>I'm trying to populate a dropwdown list in Yii2 with the person's full name, the first and last name are in my DB in different columns.</p>
  
  <p>in my Person table</p>
  
  <ul>
  <li>id</li>
  <li>first_name</li>
  <li>last_name</li>
  <li>dep_id (fk)</li>
  </ul>
  
  <p>...</p>
  
  <p>In my Person.php model I have </p>
  
  <pre><code>public function getFullName()
  {
      return $this-&gt;first_name . ' ' . $this-&gt;last_name;
  }
  </code></pre>
  
  <p>This is my helper function to get back the full name in GridViews and works fine. But I'm having trouble populating the dropdown.</p>
  
  <pre><code>    // Get person
      $person = Person::find()
                  -&gt;orderBy('last_name')
                  -&gt;asArray()
                  -&gt;all();
  
      // Person drop down
      $personMap = ArrayHelper::map($person, 'fullName', 'dep_id'); 
  </code></pre>
  
  <p>with that I get nothing in the dropdown list, but the person IDs are correct. So how would I need to go about this properly?</p>