Hi,
I am trying to use sfPropelActAsNestedSetBehaviorPlugin, but I got
some incorrect resluts.
I use the action to create test tree data:
public function executeTester(){
$root = new AboutClass();
$root->makeRoot();
$root->save();
for($i = 1; $i<=1; $i++){
$p1 = new AboutClass();
$p1->setTitle('category'.$i);
$p1->insertAsLastChildOf($root);
$p1->save();
for($j=1; $j<=1; $j++){
$p2 = new AboutClass();
$p2->setTitle('category'.$i.'-'.$j);
$p2->insertAsLastChildOf($p1);
$p2->save();
for($k=1; $k<=2; $k++){
$p3 = new AboutClass();
$p3->setTitle('category'.$i.'-'.$j.'-'.$k);
$p3->insertAsLastChildOf($p2);
$p3->save();
}
}
}
}
and my view module code is:
<?php $root = AboutClassPeer::retrieveByPK(rootID); ?>
<ul>
<?php
foreach ($root->getDescendants() as $node): ?>
<li style="padding-left: <?php echo $node->getLevel() ?>em;">
<?php echo $node->getTitle() ?>
</li>
<?php endforeach ?>
</ul>
$i,$j and $k are the parameters in my action module.
when I set $i = 1, $j =1, $k=2 , the result is:
category1
category1-1
category1-1-1
category1-1-2
but when I set $i = 1, $j =2, $k= 2, the result will be :
category1
category1-1
category1-1-1
category1-2
category1-2-1
category1-2-2
category1-1-2
I got the lever values incorrectly.
And when I set $i=2, $j=2, $k=2, the result will be :
category2
category2-1
category2-1-1
category2-2
category2-2-1
category2-2-2
category2-1-2
It miss category1 and miss some sub nodes...
Is it a bug or my mistake?
PS: attached my testing data
id tree_left tree_right tree_parent topic_id title
187 1 18
188 2 25 187 category1
189 3 28 188 category1-1
190 18 25 189 category1-1-1
191 26 27 189 category1-1-2
192 19 24 188 category1-2
193 20 21 192 category1-2-1
194 22 23 192 category1-2-2
195 4 13 187 category2
196 5 16 195 category2-1
197 6 13 196 category2-1-1
198 14 15 196 category2-1-2
199 7 12 195 category2-2
200 8 9 199 category2-2-1
201 10 11 199 category2-2-2
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---