<?php
App::uses('AppModel', 'Model');
/**
 * DreamjobUser Model
 *
 * TODO
 *
 * @property MicapplicationPtr $MicapplicationPtr
 */
class DreamjobUser extends AppModel {

/**
 * Use database config
 *
 * @var string
 */
	public $useDbConfig = 'dreamjobMain';

/**
 * Use table
 *
 * @var mixed False or table name
 */
	public $useTable = 'mic_dj_account_acc';

/**
 * Primary key field
 *
 * @var string
 */
	public $primaryKey = 'micapplication_ptr_id';

/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'micapplication_ptr_id';

/**
 * Validation rules
 *
 * @var array
 */
	public $validate = array(
		'micapplication_ptr_id' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
			'multiple' => array(
				'rule' => array('multiple'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'street' => array(
			'notEmpty' => array(
				'rule' => array('notEmpty'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'postcode' => array(
			'notEmpty' => array(
				'rule' => array('notEmpty'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
	);
	
	
	public $hasOne = array(
		'AppUser' => array(
			'className' => 'AppUser',
			'foreignKey' => 'id'
		),
		'User' => array(
		    'className' => 'User',
		    'foreignKey' => false,
		    'conditions' => array('DreamjobWorker.djaccount_ptr_id=AppUser.id and User.id = AppUser.user_id'),
		    'limit' => 1
		),
		'DreamjobListCity' => array(
			'className' => 'DreamjobListCity',
			'foreignKey' => 'city_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);
}