Jump to content

foxcraft_aw

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by foxcraft_aw

  1. Thanks for the tip! It does not work when I only uncache the parent, but it does work when I simply uncache all pages: $pages->delete($pages->get('/parent/child')); $pages->uncache(); $pages->delete($pages->get('/parent')); I did not know there was some caching going on behind the scenes. Do you know about any documentation on this mechanism?
  2. Hello! I have a strange problem with the "delete" method of the "pages" API-variable: When I insert a parent- and a child-page, and then immediately try to delete first the child- and then the parent-page, an exception is thrown telling me that the parent cannot be deleted, because it still contains a child-page. You can reproduce this behaviour using the following code: <?php require 'index.php'; $parentPage = new ProcessWire\Page; $parentPage->name = 'parent'; $parentPage->template = 'basic-page'; $parentPage->title = 'parent'; $parentPage->parent = $pages->get('/'); $parentPage->save(); $childPage = new ProcessWire\Page; $childPage->name = 'child'; $childPage->template = 'basic-page'; $childPage->title = 'child'; $childPage->parent = $pages->get('/parent'); $childPage->save(); $pages->delete($pages->get('/parent/child')); $pages->delete($pages->get('/parent')); (I put this code into a file called "experiments.php" in the root directory of the site, because I do not know of any better way for quickly testing out code in ProcessWire yet) Can you tell me why this code throws an exception? What am I missing? I am using ProcessWire 3. Thanks for your help! PS: Yes, I know about the second parameter in the "$pages->delete" method, but it should not be necessary to be set in this scenario if I`m correct.
×
×
  • Create New...