Peter Falkenberg Brown Posted August 18, 2013 Posted August 18, 2013 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
Soma Posted August 18, 2013 Posted August 18, 2013 $pages->delete($page, true); http://cheatsheet.processwire.com/?filter=delete 1
Peter Falkenberg Brown Posted August 19, 2013 Author Posted August 19, 2013 Dear Soma, I thought I must have missed something. Aarrgh. I think a good PW slogan is, "ProcessWire just keeps getting better and better." Thanks! Peter
diogo Posted August 19, 2013 Posted August 19, 2013 Although is true that PW keeps getting better. I think Martijn's sentence is more accurate 2
Peter Falkenberg Brown Posted August 25, 2013 Author Posted August 25, 2013 Dear Martijn and Diogo, Yes, I entirely agree. Peter 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now