2014-02-18 12:10:29 +01:00
|
|
|
<?php
|
|
|
|
App::uses('AppModel', 'Model');
|
|
|
|
/**
|
|
|
|
* MicDjJobsOpening Model
|
|
|
|
*
|
|
|
|
* @property Company $Company
|
|
|
|
* @property Graducation $Graducation
|
|
|
|
* @property Kindofjob $Kindofjob
|
|
|
|
*/
|
|
|
|
class DreamjobJobOpening extends AppModel {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Use database config
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $useDbConfig = 'dreamjobMain';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Use table
|
|
|
|
*
|
|
|
|
* @var mixed False or table name
|
|
|
|
*/
|
|
|
|
public $useTable = 'mic_dj_jobs_opening';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display field
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $displayField = 'title';
|
2014-11-11 09:59:52 +01:00
|
|
|
public $order = 'startdate';
|
2014-02-18 12:10:29 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2014-03-01 11:17:23 +01:00
|
|
|
)
|
2014-02-18 12:10:29 +01:00
|
|
|
),
|
|
|
|
'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
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'title' => 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
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'company_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
|
|
|
|
),
|
|
|
|
),
|
2014-03-28 16:22:19 +01:00
|
|
|
'branch_id' => array(
|
|
|
|
'numeric' => array(
|
|
|
|
'rule' => array('numeric'),
|
2014-02-18 12:10:29 +01:00
|
|
|
//'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
|
|
|
|
),
|
|
|
|
),
|
2014-03-02 11:35:22 +01:00
|
|
|
'graducation_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
|
|
|
|
),
|
|
|
|
),
|
2014-02-18 12:10:29 +01:00
|
|
|
'kindofjob_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
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'startdate' => array(
|
|
|
|
'date' => array(
|
|
|
|
'rule' => array('date'),
|
|
|
|
//'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
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'enddate' => array(
|
|
|
|
'date' => array(
|
|
|
|
'rule' => array('date'),
|
|
|
|
//'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
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'active' => 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
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'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(
|
|
|
|
'DreamjobCompany' => array(
|
|
|
|
'className' => 'DreamjobCompany',
|
2014-02-19 00:02:17 +01:00
|
|
|
'foreignKey' => 'company_id'
|
|
|
|
),
|
|
|
|
'DreamjobUser' => array(
|
|
|
|
'className' => 'DreamjobUser',
|
|
|
|
'foreignKey' => 'company_id'
|
|
|
|
),
|
|
|
|
'AppUser' => array(
|
|
|
|
'className' => 'AppUser',
|
|
|
|
'foreignKey' => 'company_id'
|
2014-02-18 12:10:29 +01:00
|
|
|
),
|
|
|
|
'DreamjobListGraducation' => array(
|
|
|
|
'className' => 'DreamjobListGraducation',
|
|
|
|
'foreignKey' => 'graducation_id',
|
|
|
|
'conditions' => '',
|
|
|
|
'fields' => '',
|
|
|
|
'order' => ''
|
|
|
|
),
|
|
|
|
'DreamjobListKindofjob' => array(
|
|
|
|
'className' => 'DreamjobListKindofjob',
|
|
|
|
'foreignKey' => 'kindofjob_id',
|
|
|
|
'conditions' => '',
|
|
|
|
'fields' => '',
|
|
|
|
'order' => ''
|
2014-03-28 16:22:19 +01:00
|
|
|
),
|
|
|
|
'DreamjobListBranch' => array(
|
|
|
|
'className' => 'DreamjobListBranch',
|
|
|
|
'foreignKey' => 'branch_id',
|
|
|
|
'conditions' => '',
|
|
|
|
'fields' => '',
|
|
|
|
'order' => ''
|
2014-04-22 16:01:00 +02:00
|
|
|
),
|
|
|
|
'DreamjobListCity' => array(
|
|
|
|
'className' => 'DreamjobListCity',
|
|
|
|
'foreignKey' => 'city_id',
|
|
|
|
'conditions' => '',
|
|
|
|
'fields' => '',
|
|
|
|
'order' => ''
|
2014-02-18 12:10:29 +01:00
|
|
|
)
|
|
|
|
);
|
2014-03-02 11:35:22 +01:00
|
|
|
|
2014-02-19 00:02:17 +01:00
|
|
|
public $hasOne = array(
|
|
|
|
'User' => array(
|
|
|
|
'className' => 'User',
|
|
|
|
'foreignKey' => false,
|
|
|
|
'conditions' => array('DreamjobJobOpening.company_id = AppUser.id and User.id = AppUser.user_id'),
|
|
|
|
'limit' => 1
|
|
|
|
)
|
|
|
|
);
|
2014-03-02 11:35:22 +01:00
|
|
|
|
|
|
|
public $hasMany = array(
|
|
|
|
'DreamjobJobApplication' => array(
|
|
|
|
'className' => 'DreamjobJobApplication',
|
|
|
|
'foreignKey' => 'opening_id'
|
|
|
|
),
|
|
|
|
);
|
2014-02-18 12:10:29 +01:00
|
|
|
}
|