Add find method for returning hash of Config table

This commit is contained in:
Kyle Johnson 2015-03-03 09:25:02 -05:00
parent a4c5f83c8c
commit a395f9a9f7
1 changed files with 12 additions and 0 deletions

View File

@ -27,4 +27,16 @@ class Config extends AppModel {
*/ */
public $displayField = 'Value'; 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;
}
} }