Search the Community
Showing results for tags 'delete()'.
-
I have a file field named "resume". I want to delete the file saved in it using the API. The field is limited to only 1 upload of file and the return type is set to "Automatic" which means it will return a single object if a file is available. Now there are two options that I have tried- delete() and deleteAll(). $page_to_change = $pages->get("name=xyz"); $page_to_change->resume->deleteAll(); //OR //$page_to_change->resume->delete($page_to_change->resume); $page_to_change->of(false); $page_to_change->save(); Both of these give an error like- Error: Exception: Method Pagefile::deleteAll does not exist or is not callable in this context(...) I understand that this error is because these two functions work on a wirearray rather than on a file object. But how do I delete a single file?
-
Recently I was in trouble filling a repeater inside a foreach loop (Creating pages from a CVS File). One of the steps in my script was delete all existing pages before start creating new ones. Discovered that after using $page->delete() and create a new page I could't fill my repeater fields. Then if I use $page->trash() no problem, and the repeater's were created and correctly filled. What's the difference between delete and trash? Is there some internal pointer that get lost when delete() is called affecting the behaviour of the New() function or getNew()? The original problem is in this tread: https://processwire.com/talk/topic/11130-problem-addingpopulating-repeater-using-api/ Thank's.
-
Hello, when I delete a page with repeater fields, the fields data stays in the DB. Is there a way to delete these or a way to find out which data in the "pages" table is from repeaters? I added and deleted about 4000 pages via a script and now my "pages" table is a mess ... Thanks, thomas