diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 408e811..700eafd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ Contributing ============ -This repository follows the [CakeDC Plugin Standard](http://cakedc.com/plugins). If you'd like to contribute new features, enhancements or bug fixes to the plugin, please read our [Contribution Guidelines](http://cakedc.com/plugins) for detailed instructions. \ No newline at end of file +This repository follows the [CakeDC Plugin Standard](http://cakedc.com/plugin-standard). If you'd like to contribute new features, enhancements or bug fixes to the plugin, please read our [Contribution Guidelines](http://cakedc.com/plugin-standard) for detailed instructions. \ No newline at end of file diff --git a/Model/Behavior/SoftDeleteBehavior.php b/Model/Behavior/SoftDeleteBehavior.php index b2fa860..22d86ea 100644 --- a/Model/Behavior/SoftDeleteBehavior.php +++ b/Model/Behavior/SoftDeleteBehavior.php @@ -42,6 +42,13 @@ class SoftDeleteBehavior extends ModelBehavior { * @param array $settings */ public function setup(Model $model, $settings = array()) { + //Issue #147: Don't activate behavior if table is not found. Prevents unit tests from failing + try{ + $model->setSource($model->table); + } catch (MissingTableException $e) { + return; + } + if (empty($settings)) { $settings = $this->default; } elseif (!is_array($settings)) { @@ -346,13 +353,6 @@ protected function _softDeleteAssociations(Model $model, $active) { $parentModels = array_keys($model->belongsTo); foreach ($parentModels as $parentModel) { - list($plugin, $modelClass) = pluginSplit($parentModel, true); - App::uses($modelClass, $plugin . 'Model'); - if (!class_exists($modelClass)) { - throw new MissingModelException(array('class' => $modelClass)); - } - $model->{$parentModel} = new $parentModel(null, null, $model->useDbConfig); - foreach (array('hasOne', 'hasMany') as $assocType) { if (empty($model->{$parentModel}->{$assocType})) { continue;