Skip to content

Commit

Permalink
had to add a check because migration was having problems with no tabl…
Browse files Browse the repository at this point in the history
…e. this should be fixed in migrations rather.
  • Loading branch information
dogmatic69 committed Jan 30, 2010
1 parent ae9b0f4 commit e657d29
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion extensions/libs/models/behaviors/logable.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ class LogableBehavior extends ModelBehavior {
'ignore' => array(),
'classField' => 'model',
'foreignKey' => 'model_id'
);
);

/**
* Cake called intializer
* Config options are :
Expand All @@ -89,12 +90,19 @@ class LogableBehavior extends ModelBehavior {
* @param array $config
*/
function setup(&$Model, $config = array()) {

if (!is_array($config)) {
$config = array();
}
$this->settings[$Model->alias] = array_merge($this->defaults, $config);
$this->settings[$Model->alias]['ignore'][] = $Model->primaryKey;


if (!in_array('core_logs', ConnectionManager::getDataSource($Model->useDbConfig)->listSources())) {
$this->default['enabled'] = $this->settings[$Model->alias]['enabled'] = false;
return true;
}

$this->Log = &ClassRegistry::init($this->settings[$Model->alias]['logModel']);
if ($this->settings[$Model->alias]['userModel'] != $Model->alias) {
$this->UserModel = &ClassRegistry::init($this->settings[$Model->alias]['userModel']);
Expand Down

0 comments on commit e657d29

Please sign in to comment.