private function set_values_profile(\Model_Profile $obj, $values) { $cols = \DB::list_columns('profile'); foreach ($cols as $col => $props) { if (in_array($col, array('id', 'sort_order', 'created_at', 'updated_at'))) { continue; } $obj->{$col} = $values[$col]; } if (!isset($obj->sort_order) || is_null($obj->sort_order)) { $obj->sort_order = \Model_Profile::get_next_sort_order(); } return $obj; }