Google Groups Home
Help | Sign in
ACO::setParent adds an empty record
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Marcel  
View profile
 More options Mar 28, 7:21 am
From: Marcel <mraaijmak...@gmail.com>
Date: Fri, 28 Mar 2008 04:21:58 -0700 (PDT)
Local: Fri, Mar 28 2008 7:21 am
Subject: ACO::setParent adds an empty record
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?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marcel  
View profile
 More options Mar 28, 8:34 am
From: Marcel <mraaijmak...@gmail.com>
Date: Fri, 28 Mar 2008 05:34:39 -0700 (PDT)
Local: Fri, Mar 28 2008 8:34 am
Subject: Re: ACO::setParent adds an empty record
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 <mraaijmak...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google