2014-02-18 12:10:29 +01:00
|
|
|
<?php
|
|
|
|
App::uses('AppModel', 'Model');
|
|
|
|
/**
|
|
|
|
* DreamjobCompany Model
|
|
|
|
*
|
|
|
|
* TODO
|
|
|
|
*
|
|
|
|
* @property
|
|
|
|
*/
|
|
|
|
class DreamjobCompany extends AppModel {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Use database config
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $useDbConfig = 'dreamjobMain';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Use table
|
|
|
|
*
|
|
|
|
* @var mixed False or table name
|
|
|
|
*/
|
|
|
|
public $useTable = 'mic_dj_account_cmpy';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Primary key field
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $primaryKey = 'djaccount_ptr_id';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display field
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $displayField = 'djaccount_ptr_id';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Validation rules
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
public $validate = array(
|
|
|
|
'djaccount_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
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'corporateform' => 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
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'owner' => 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
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'branch' => 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
|
|
|
|
),
|
|
|
|
),
|
2014-02-19 00:02:17 +01:00
|
|
|
'pro_user' => 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
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
public $hasAndBelongsToMany = array(
|
|
|
|
'User' =>
|
|
|
|
array(
|
|
|
|
'className' => 'User',
|
|
|
|
'with' => 'AppUser',
|
|
|
|
//'joinTable' => 'mic_sys_micapp',
|
|
|
|
'foreignKey' => 'id',
|
|
|
|
'associationForeignKey' => 'user_id',
|
|
|
|
'limit' => 1
|
|
|
|
)
|
|
|
|
);
|
|
|
|
public $hasOne = array(
|
|
|
|
'DreamjobUser' => array(
|
|
|
|
'className' => 'DreamjobUser',
|
|
|
|
'foreignKey' => 'micapplication_ptr_id'
|
|
|
|
),
|
|
|
|
'AppUser' => array(
|
|
|
|
'className' => 'AppUser',
|
|
|
|
'foreignKey' => 'id'
|
2014-02-19 00:02:17 +01:00
|
|
|
),
|
|
|
|
'User' => array(
|
|
|
|
'className' => 'User',
|
|
|
|
'foreignKey' => false,
|
|
|
|
'conditions' => array('DreamjobCompany.djaccount_ptr_id=AppUser.id and User.id = AppUser.user_id'),
|
|
|
|
'limit' => 1
|
|
|
|
)
|
|
|
|
);
|
2014-02-18 12:10:29 +01:00
|
|
|
public $hasMany = array(
|
|
|
|
'DreamjobPageInh' => array(
|
|
|
|
'className' => 'DreamjobPageInh',
|
|
|
|
'foreignKey' => 'user_id'
|
|
|
|
),
|
|
|
|
'DreamjobJobOpening' => array(
|
|
|
|
'className' => 'DreamjobJobOpening',
|
|
|
|
'foreignKey' => 'company_id'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|