<?php
	class CustomerViewModel extends ViewModel {
        protected $viewFields;
		public function _initialize(){
			$main_must_field = array('customer_id','owner_role_id','is_locked','creator_role_id','contacts_id','delete_role_id','create_time','delete_time','update_time','is_deleted');
			$main_list = array_unique(array_merge(M('Fields')->where(array('model'=>'customer','is_main'=>1))->getField('field', true),$main_must_field));
			$data_list = M('Fields')->where(array('model'=>'customer','is_main'=>0))->getField('field', true);
			$data_list['_on'] = 'customer.customer_id = customer_data.customer_id';
			$this->viewFields = array('customer'=>$main_list,'customer_data'=>$data_list);
		}
	}