I have a model/database table that looks like this
id | group_id| first_name | middle_name | last_name
------------------------------------------------------
| | | |
------------------------------------------------------
After retrieving a model from the database:
say:
$people = PersonModel::model()->findAllByAttributes(array('group_id'=>$groupId));
and suppose i've retrieved 10 rows.. matching the groupId given
I want to store all the first_name of the 10 rows that matched.
I know this can be done by:
$personArray = array();
foreach($people as $person){
$personArray[] = $person->first_name;
}
but is there another way, e.g. a php function that does the same thing? Thank you!