dreamjob/app/Model/DreamjobJobApplication.php

187 lines
5.3 KiB
PHP

<?php
App::uses('AppModel', 'Model');
/**
* MicDjJobsApplication Model
*
* @property Worker $Worker
* @property Opening $Opening
*/
class DreamjobJobApplication extends AppModel {
/**
* Use database config
*
* @var string
*/
public $useDbConfig = 'dreamjobMain';
/**
* Use table
*
* @var mixed False or table name
*/
public $useTable = 'mic_dj_jobs_application';
/**
* Display field
*
* @var string
*/
public $displayField = 'id';
/**
* Validation rules
*
* @var array
*/
public $validate = array(
'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
),
),
'stars' => 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
),
),
'closed' => array(
'boolean' => array(
'rule' => array('boolean'),
//'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
),
),
'offered' => array(
'boolean' => array(
'rule' => array('boolean'),
//'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
),
),
'saw' => array(
'boolean' => array(
'rule' => array('boolean'),
//'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
),
),
'worker_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
),
),
'opening_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
),
),
'text' => 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
),
),
);
//The Associations below have been created with all possible keys, those that are not needed can be removed
/**
* belongsTo associations
*
* @var array
*/
public $belongsTo = array(
'DreamjobWorker' => array(
'className' => 'DreamjobWorker',
'foreignKey' => 'worker_id'
),
'DreamjobUserWorker' => array(
'className' => 'DreamjobUser',
'foreignKey' => 'worker_id'
),
'AppUserWorker' => array(
'className' => 'AppUser',
'foreignKey' => 'worker_id'
),
'DreamjobJobOpening' => array(
'className' => 'DreamjobJobOpening',
'foreignKey' => 'opening_id'
)
);
public $hasOne = array(
'DreamjobCompany' => array(
'className' => 'DreamjobCompany',
'foreignKey' => false,
'conditions' => array('DreamjobJobOpening.company_id = DreamjobCompany.djaccount_ptr_id'),
'limit' => 1
),
'DreamjobUser' => array(
'className' => 'DreamjobUser',
'foreignKey' => false,
'conditions' => array('DreamjobJobOpening.company_id = DreamjobUser.micapplication_ptr_id'),
'limit' => 1
),
'AppUser' => array(
'className' => 'AppUser',
'foreignKey' => false,
'conditions' => array('DreamjobJobOpening.company_id = AppUser.id'),
'limit' => 1
),
'User' => array(
'className' => 'User',
'foreignKey' => false,
'conditions' => array('DreamjobJobOpening.company_id = AppUser.id and User.id = AppUser.user_id'),
'limit' => 1
),
'DreamjobListKindofjob' => array(
'className' => 'DreamjobListKindofjob',
'foreignKey' => false,
'conditions' => array('DreamjobJobOpening.kindofjob_id = DreamjobListKindofjob.id'),
'limit' => 1
),
'DreamjobListGraducation' => array(
'className' => 'DreamjobListGraducation',
'foreignKey' => false,
'conditions' => array('DreamjobJobOpening.graducation_id = DreamjobListGraducation.id'),
'limit' => 1
),
);
}