Multiple Form Select Column Name

How can i add a firstnameand lastname in a Form select ?


$form->add(new Select( "client" , Clients::find() ,
[
'using'         =>  ['id','firstname'], # so i can select the firstname but i also want to add the lastname with the first
'data-placeholder' => "Members",
'class'            => "chosen-select"
]
));


6.6k
edited May '16

Like this:


      $form->add(new Select( "client" , Clients::find(
              [
                  'columns' => ['CONCAT(firstname, " ", lastname) as fullname', 'id']       # This is for MySQL database
              ]
        ) ,
          [
          'using'           =>  ['id','fullname'], 
          'data-placeholder' => "Members",
          'class'            => "chosen-select"
          ]
        )
      );