murze
murze

Reputation: 4103

How to move treenodes with Gedmo's NestedSet Behaviour

i'm using Doctrine 2 and the NestedSet extension. In Doctrine 1 you had the functions moveAsPrevSiblingOf, moveAsNextSiblingOf and moveAsLastChildOf To move nodes around.

In the documentation of the nested extension only moving a node within the same parent is explained. Move a node to another node is not mention. How can this be done?

Are there easy to use functions as found in Doctrine 1 available?

Upvotes: 2

Views: 1560

Answers (1)

murze
murze

Reputation: 4103

In the documentation there are examples on how to move the nodes.

$treeRepository
    ->persistAsFirstChild($food)
    ->persistAsFirstChildOf($fruits, $food)
    ->persistAsLastChildOf($vegitables, $food)
    ->persistAsNextSiblingOf($carrots, $fruits);

Upvotes: 1

Related Questions