Model fuer Service
This commit is contained in:
parent
717220b8d1
commit
5a2bdb4225
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
App::uses('AppModel', 'Model');
|
||||
/**
|
||||
* DreamjobListCity Model
|
||||
*
|
||||
*/
|
||||
class DreamjobService extends AppModel {
|
||||
|
||||
/**
|
||||
* Use database config
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $useDbConfig = 'dreamjobMain';
|
||||
|
||||
/**
|
||||
* Use table
|
||||
*
|
||||
* @var mixed False or table name
|
||||
*/
|
||||
public $useTable = 'mic_dj_service';
|
||||
|
||||
/**
|
||||
* Display field
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $displayField = 'title';
|
||||
public $order = 'title';
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $validate = array(
|
||||
'id' => array(
|
||||
'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
|
||||
),
|
||||
'naturalNumber' => array(
|
||||
'rule' => array('naturalNumber'),
|
||||
//'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
|
||||
)
|
||||
),
|
||||
);
|
||||
public $belongsTo = array(
|
||||
'Category' => array(
|
||||
'className' => 'DreamjobServiceCategory',
|
||||
'foreignKey' => 'category',
|
||||
'conditions' => '',
|
||||
'fields' => '',
|
||||
'order' => ''
|
||||
),
|
||||
);
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
App::uses('AppModel', 'Model');
|
||||
/**
|
||||
* DreamjobListCity Model
|
||||
*
|
||||
*/
|
||||
class DreamjobServiceCategory extends AppModel {
|
||||
|
||||
/**
|
||||
* Use database config
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $useDbConfig = 'dreamjobMain';
|
||||
|
||||
/**
|
||||
* Use table
|
||||
*
|
||||
* @var mixed False or table name
|
||||
*/
|
||||
public $useTable = 'mic_dj_service_category';
|
||||
|
||||
/**
|
||||
* Display field
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $displayField = 'title';
|
||||
public $order = 'title';
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $validate = array(
|
||||
'id' => array(
|
||||
'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
|
||||
),
|
||||
'naturalNumber' => array(
|
||||
'rule' => array('naturalNumber'),
|
||||
//'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
|
||||
),
|
||||
'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
|
||||
)
|
||||
),
|
||||
);
|
||||
public $hasMany = array(
|
||||
'Service' => array(
|
||||
'className' => 'DreamjobService',
|
||||
'foreignKey' => 'category',
|
||||
'dependent' => true
|
||||
)
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue