2014-04-23 11:14:08 +08:00
|
|
|
<?php
|
|
|
|
App::uses('AppModel', 'Model');
|
|
|
|
/**
|
|
|
|
* Config Model
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class Config extends AppModel {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Use table
|
|
|
|
*
|
|
|
|
* @var mixed False or table name
|
|
|
|
*/
|
|
|
|
public $useTable = 'Config';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Primary key field
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2015-06-11 10:58:58 +08:00
|
|
|
public $primaryKey = 'Name';
|
2014-04-23 11:14:08 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Display field
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2015-06-11 10:58:58 +08:00
|
|
|
public $displayField = 'Value';
|
|
|
|
|
|
|
|
|
|
|
|
// Add a find method for returning a hash of the Config table.
|
|
|
|
// This is used for the Options view.
|
|
|
|
public $findMethods = array('hash' => true);
|
|
|
|
protected function _findHash($state, $query, $results = array()) {
|
|
|
|
if ($state === 'before') {
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
$results = Set::combine($results, '{n}.Config.Name', '{n}.Config');
|
|
|
|
return $results;
|
|
|
|
}
|
2014-04-23 11:14:08 +08:00
|
|
|
|
|
|
|
}
|