public function getFullName()
return $this->client_firstname.' '.$this->client_lastname;
public function clientsOrderByDateCreated()
$sql = 'SELECT * FROM clients ORDER BY date_created DESC';
$clientdata = Clients::findBySql($sql)->asArray()->all();
In my view you can see that I am calling the clientsOrderByDateCreated function which returns an array of data. I then use that array of data in the ArrayHelper map for the dropDownList. Also in the dropDownList I use fullName which is a function in the Clients model class.
Now from what I can find is that in the getFullName function, I am using $this, which is obviously not working. I have also tried setting the $clientdata as global variable and using $clientdata->client_firstname, but that is also not working.
How do I reference the array correctly in the getFullName function?
Or is there a better way to sort the model? I don’t mind sorting the complete model as I will always want to see the last added client first.