从Cakephp树中移除分支(树行为)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从Cakephp树中移除分支(树行为)相关的知识,希望对你有一定的参考价值。

  1. // si estoy editando un registro elimino toda su rama del arbol
  2. // para no poder moverlo adentro de si mismo
  3.  
  4. if ( !empty( $id ) ) :
  5. // traigo todos los IDs hijos de este nodo
  6. $childrens = $this->Tender->children($id);
  7. $childrensClean = Set::extract('/Tender/id', $childrens);
  8. // agrego el ID del propio nodo a la lista de exclusión
  9. $childrensClean[] = $id;
  10. $options = array( 'NOT' => array( 'Tender.id' => $childrensClean ) );
  11. else:
  12. $options = array();
  13. endif;
  14.  
  15. $parents = $this->Tender->generatetreelist($options, '{n}.Tender.id', '{n}.Tender.title_cat', '     ' );
  16. $this->set('parents', $parents );

以上是关于从Cakephp树中移除分支(树行为)的主要内容,如果未能解决你的问题,请参考以下文章