Jump to content

$pages->delete($child_page, true) causes current $page to lose values on save


Peter Falkenberg Brown
 Share

Recommended Posts

Hello PW Gurus,

I'm stuck on a strange symptom. I've created a routine to edit and update a page of values via a form and the api.

Part of that routine is to add and/or delete child pages of a different page branch.

When I run through the edit / update and use the code:

$pages->delete($domain_ip_former_page_child_page, true);

and then further down, do a:

$pages->save($page);

the currently selected values of the primary page do not get saved. Somewhere between selection of the values and the save command, the $page object loses the selected values.

When I comment out the delete command, the primary page saves correctly.

Also, the delete command (when used) does successfully delete the child page in question.

I get the child page with this code (ignore the line breaks):

$domain_ip_former_page_child_page = 
$pages->get( "parent=$domain_ip_former_page_url, account_id=$account_page_account_id, 
include=hidden, $skiptrash" );

I just can't figure out why a page delete command would mess with the values of the current $page object.

Anyone have any thoughts?

Edit: I'm using PW 2.3.0.

Thanks,

Peter

Link to comment
Share on other sites

Have you tried this? Maybe it's not the $page object which got messed with. But if you don't override $page or $pages this shouldn't happen. 

$page->save();

Of topic: Maybe think about updateing pw. The current stable version is 2.5.3, with lots of great new features.

Link to comment
Share on other sites

Have you tried this? Maybe it's not the $page object which got messed with. But if you don't override $page or $pages this shouldn't happen. 

$page->save();

Of topic: Maybe think about updateing pw. The current stable version is 2.5.3, with lots of great new features.

Yes, I've tried with $page->save() with the same result.

My code to save or delete the other pages is specifically using a different variable for those page objects,

so I would think that there shouldn't be any conflict.

I wonder, however, if in the internals of PW code there's a variable conflict, i.e. in the processing

of the other pages, some code uses the $page object.

I can't upgrade with this particular application because of client requirements.

Yours,

Peter

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...