Hello all!
I'm trying to implement functionality in my CMS system to be able to
move up/down items on the list based on "position" column.
Here is my code:
public function admin_up($position) {
$neighbours = $this->News->find('neighbors', array('position' =>
$position));
$currentRecord = $this->News->findByPosition($position);
$currentRecord = $currentRecord['News'];
$previousRecord = $neighbours['prev']['News'];
$this->temp = $previousRecord;
$this->News->id = $previousRecord['id'];
$this->News->position = $currentRecord['position'];
$this->News->save();
$this->News->id = $currentRecord['id'];
$this->News->position = $this->temp['position'];
$this->News->save();
// $this->Session->setFlash("News został przesunięty!");
// $this->redirect('index');
}
and SQL dump:
UPDATE `news` SET `id` = 20, `position` = 23 WHERE `news`.`id` = 20
UPDATE `news` SET `id` = 20, `position` = 23 WHERE `news`.`id` = 20
it invokes bad parametrs in second call. Why? I spent for it 10 hours
and still the same results...
Please help, I'm getting confused! :S
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---