2014-02-18 12:10:29 +01:00
|
|
|
<?php
|
|
|
|
App::uses('AppModel', 'Model');
|
|
|
|
/**
|
|
|
|
* MicDjPageTxt Model
|
|
|
|
*
|
|
|
|
* @property PagePtr $PagePtr
|
|
|
|
*/
|
|
|
|
class DreamjobPageText extends AppModel {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Use database config
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $useDbConfig = 'dreamjobMain';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Use table
|
|
|
|
*
|
|
|
|
* @var mixed False or table name
|
|
|
|
*/
|
|
|
|
public $useTable = 'mic_dj_page_txt';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Primary key field
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $primaryKey = 'page_ptr_id';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display field
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $displayField = 'page_ptr_id';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Validation rules
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
2014-04-16 15:41:56 +02:00
|
|
|
public function delete($id = NULL, $cascade = false){
|
|
|
|
$dataSource = $this->getDataSource();
|
|
|
|
$dataSource->begin();
|
2014-05-01 12:29:45 +02:00
|
|
|
$result = $this->DreamjobPageInh->delete($id,$cascade);
|
2014-04-16 15:41:56 +02:00
|
|
|
if($result){
|
2014-05-01 12:29:45 +02:00
|
|
|
$result = parent::delete($id,$cascade);
|
2014-04-16 15:41:56 +02:00
|
|
|
}
|
|
|
|
if ($result) {
|
|
|
|
$dataSource->commit();
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
$dataSource->rollback();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2014-02-18 12:10:29 +01:00
|
|
|
public $validate = array(
|
|
|
|
'page_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
|
|
|
|
),
|
|
|
|
),
|
2014-03-23 10:16:15 +01:00
|
|
|
// 'text' => array(),
|
2014-02-18 12:10:29 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
//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(
|
|
|
|
'DreamjobPageInh' => array(
|
|
|
|
'className' => 'DreamjobPageInh',
|
|
|
|
'foreignKey' => 'page_ptr_id',
|
|
|
|
'conditions' => '',
|
|
|
|
'fields' => '',
|
|
|
|
'order' => ''
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|