Przeglądaj źródła

[doc] note about tree removeFromTree method safety

gedi 13 lat temu
rodzic
commit
d6d8ac1159

+ 3 - 1
doc/tree.md

@@ -382,6 +382,8 @@ $repo->recover();
 $em->clear(); // clear cached nodes
 // if tree has errors it will try to fix all tree nodes
 
+UNSAFE: be sure to backup before runing this method when necessary, if you can use $em->remove($node);
+// which would cascade to children
 // single node removal
 $vegies = $repo->findOneByTitle('Vegitables');
 $repo->removeFromTree($vegies);
@@ -1009,4 +1011,4 @@ it locks the tree and proceed with the modification. After all the modifications
 
 If, for some reason, the lock couldn't get freed, there's a lock timeout configured with a default time of 3 seconds.
 You can change this value using the **lockingTimeout** parameter under the Tree annotation (or equivalent in XML and YML).
-You must pass a value in seconds to this parameter.
+You must pass a value in seconds to this parameter.

+ 2 - 0
lib/Gedmo/Tree/Entity/Repository/NestedTreeRepository.php

@@ -623,6 +623,8 @@ class NestedTreeRepository extends AbstractTreeRepository
     }
 
     /**
+     * UNSAFE: be sure to backup before runing this method when necessary
+     *
      * Removes given $node from the tree and reparents its descendants
      *
      * @param object $node