Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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.
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.
14 changes: 7 additions & 7 deletions Model/Behavior/SoftDeleteBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
Expand Down