mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-02 17:42:41 +00:00
allow other parent field, set in find options or TreeHebavior, for threaded find. Fixes #1769
This commit is contained in:
parent
b62d9729a9
commit
2a9e6771c3
4 changed files with 203 additions and 2 deletions
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue