allow other parent field, set in find options or TreeHebavior, for threaded find. Fixes #1769

This commit is contained in:
Ceeram 2012-01-19 23:20:15 +01:00
parent b62d9729a9
commit 2a9e6771c3
4 changed files with 203 additions and 2 deletions

View file

@ -92,6 +92,20 @@ class TreeBehavior extends ModelBehavior {
}
}
/**
* Runs before a find() operation
*
* @param Model $Model Model using the behavior
* @param array $query Query parameters as set by cake
* @return array
*/
public function beforeFind($Model, $query) {
if ($Model->findQueryType == 'threaded' && !isset($query['parent'])) {
$query['parent'] = $this->settings[$Model->alias]['parent'];
}
return $query;
}
/**
* Before delete method. Called before all deletes
*