Jump to content

Refreshing $page object after deleting child records


Recommended Posts

Dear All,

I have some code where I get a page object, e.g. "$some_page", that has a child record.

Since $some_page->delete() won't work if there's a child record (unless there's a flag I'm missing),

I naturally added code to delete the child page first, e.g.

$child_page->delete();

After doing so, $some_page did not recognize that the child page had been deleted, and still complained,

until I added code to recreate the $some_page object, after the child page had been deleted.

After that, it all worked. My question is: Is there a better way to delete branches of pages than the method above?

A "force flag" to delete all children would be great. I'm probably missing something.

Thanks,

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...