Frank,
Thank your reply and provide the solution. You're right, $object is
stand for the record itself and correct code should be $node5-
>moveToTop();
After a 4 hours sleeping, I decide to study source code.
The part of source code
....
public function moveToTop($object, $con = null)
{
return self::moveToPosition($object, 1, $con);
// notice "1", that is mean...there is only 1 position can be set to
the object.
}
so, I add a new method in sfPropelActAsSortableBehaviorPlugin by
myself.
public function moveUpward($object, $stepObject, $con = null)
{
$newPosition = self::getPosition($stepObject);
return self::moveToPosition($object, $newPosition, $con);
}
Ok, right now, I can move the $node5 like this.
$node3 = abcPeer::retrieveByPK(3);
$node5->moveUpward($node3);
The result will be
id rank topic_id
1 1 1
2 2 1
3 4 2
4 5 2
5 3 2
Ha..it is what I want.
On 9月5日, 上午3時02分, Frank Stelzer <[EMAIL PROTECTED]> wrote:
> Does this work?
>
> > $node5 = abcPeer::retrieveByPK(5);
> > $node5->moveToTop($node5);
>
> moveToTop takes a sortable object, so $node5 itself.
>
> Am 04.09.2007 um 20:09 schrieb Cipher Chien:
>
> > $node5 = abcPeer::retrieveByPK(5);
> > $node5->moveToTop($records);
> > //hum... this is not work.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---