Merge pull request #9867 from chinpei215/2.x-tree-behavior

[2.x] Fix TreeBehavior does access property/method via model
This commit is contained in:
Mark Story 2016-12-12 21:24:47 -05:00 committed by GitHub
commit cdef76eeda

View file

@ -112,11 +112,12 @@ class TreeBehavior extends ModelBehavior {
* @return void
*/
protected function _setChildrenLevel(Model $Model, $id) {
$settings = $Model->Behaviors->Tree->settings[$Model->alias];
$settings = $this->settings[$Model->alias];
$primaryKey = $Model->primaryKey;
$depths = array($id => (int)$Model->data[$Model->alias][$settings['level']]);
$children = $Model->children(
$children = $this->children(
$Model,
$id,
false,
array($primaryKey, $settings['parent'], $settings['level']),