I got it working like this, but isn't there an easier way using
setParent?
In the menu_controller that handles the reparent action:
//get aco of the node to move (thisAco) and the new parent (otherAco)
//The 0 says we do not want to get the aros (if any)
$thisAco = $this->Menu->Aco->find(array("model"=>"Menu",
"foreign_key"=>$movedID), array(), null, 0);
$otherAco = $this->Menu->Aco->find(array("model"=>"Menu",
"foreign_key"=>$destID), array(), null, 0);
//update parent and save
$thisAco["Aco"]["parent_id"] = $otherAco["Aco"]["id"];
$this->Menu->Aco->save($thisAco);
On 28 mrt, 12:21, Marcel <[EMAIL PROTECTED]> wrote:
> Helllo!
>
> I can't get setParent on an aco to work using the console:
>
> Menu:
> id | title
> 1 | websites
> 2 | mysite.nl
> 3 | admin
> 5 | news
> 4 | www
>
> Aco:
> id | parent_id | model | foreign_key
> 17 | null | Menu | 2
> 18 | 17 | Menu | 3
> 19 | 17 | Menu | 4
> 20 | 18 | Menu | 5
>
> Now, I want to move news under www so I do this:
> cake acl setParent aco 20 19
>
> But the result of this action is that a new aco record is added with
> parent_id set to 19, but all other fields like model, lft, rght are
> null.
>
> What am I doing wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---