Model fuer Service

This commit is contained in:
Martin Müller 2014-09-10 19:27:15 +02:00
parent 717220b8d1
commit 5a2bdb4225
2 changed files with 156 additions and 0 deletions

75
app/Model/DreamjobService.php Executable file
View File

@ -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' => ''
),
);
}

View File

@ -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
)
);
}