static function fillAvatars(&$profiles, $width) { $ids = array(); foreach ($profiles as $profile) { if (!empty($profile)) { $ids[] = $profile->id; } } $avatars = Avatar::pivotGet('profile_id', $ids, array('width' => $width, 'height' => $width)); foreach ($profiles as $profile) { if (!empty($profile)) { // ??? $profile->_fillAvatar($width, $avatars[$profile->id]); } } }