Closed LeLuyen closed 8 years ago
Hi Chris,
I am creating 2 terms reference on one content type.
However when create new content with this content type, have error.
"The "Tree" alias has already been loaded with the following config: array ( 'implementedFinders' => array ( 'path' => 'findPath', 'children' => 'findChildren', 'treeList' => 'findTreeList', ), 'implementedMethods' => array ( 'childCount' => 'childCount', 'moveUp' => 'moveUp', 'moveDown' => 'moveDown', 'recover' => 'recover', 'removeFromTree' => 'removeFromTree', 'getLevel' => 'getLevel', 'formatTreeList' => 'formatTreeList', ), 'parent' => 'parent_id', 'left' => 'lft', 'right' => 'rght', 'scope' => array ( 'vocabulary_id' => '1', ), 'level' => NULL, 'recoverOrder' => NULL, ) which differs from array ( 'scope' => array ( 'vocabulary_id' => '8', ), )"
The method 'edit' of class TermField extends Handler have problem. `public function edit(Field $field, View $view) { $terms = []; if ($field->metadata->settings['vocabulary']) { $TermsTable = TableRegistry::get('Taxonomy.Terms'); $TermsTable->addBehavior('Tree', ['scope' => ['vocabulary_id' => $field->metadata->settings['vocabulary']]]); $terms = $TermsTable->find('treeList', ['spacer' => ' ']); }
return $view->element('Taxonomy.taxonomy_field_edit', compact('field', 'terms')); }`
I fixed it with add $TermsTable->removeBehavior('Tree') before the line $TermsTable->addBehavior(...
Please update source, thanks you!
Hi Chris,
I am creating 2 terms reference on one content type.
However when create new content with this content type, have error.
"The "Tree" alias has already been loaded with the following config: array ( 'implementedFinders' => array ( 'path' => 'findPath', 'children' => 'findChildren', 'treeList' => 'findTreeList', ), 'implementedMethods' => array ( 'childCount' => 'childCount', 'moveUp' => 'moveUp', 'moveDown' => 'moveDown', 'recover' => 'recover', 'removeFromTree' => 'removeFromTree', 'getLevel' => 'getLevel', 'formatTreeList' => 'formatTreeList', ), 'parent' => 'parent_id', 'left' => 'lft', 'right' => 'rght', 'scope' => array ( 'vocabulary_id' => '1', ), 'level' => NULL, 'recoverOrder' => NULL, ) which differs from array ( 'scope' => array ( 'vocabulary_id' => '8', ), )"
The method 'edit' of class TermField extends Handler have problem. `public function edit(Field $field, View $view) { $terms = []; if ($field->metadata->settings['vocabulary']) { $TermsTable = TableRegistry::get('Taxonomy.Terms'); $TermsTable->addBehavior('Tree', ['scope' => ['vocabulary_id' => $field->metadata->settings['vocabulary']]]); $terms = $TermsTable->find('treeList', ['spacer' => ' ']); }
I fixed it with add $TermsTable->removeBehavior('Tree') before the line $TermsTable->addBehavior(...
Please update source, thanks you!