Jump to content

Repeater fields via API: It has no parent assigned


thomas
 Share

Recommended Posts

Hello,

I'm just moving a site to a production server and deleted all my pages via the API. Now I try to re-import the pages again via a script but I get the error 'Can't save page: It has no parent assigned' when trying to add the repeater fields. I don't know what went wrong and how and where a parent for a repeater is assigned.

Can anyone help?

Thanks,

thomas

Link to comment
Share on other sites

Repeaters are always under /processwire/repeaters/for-field-130/for-page-2757/, where "processwire" is your admin name, "130" is the id of the repeater field, and "2757" is the id of the page where the field is.

Link to comment
Share on other sites

Hello, I'm just moving a site to a production server and deleted all my pages via the API.

I'm not clear what you mean about "deleted all my pages". At least, this is not usually a step one would take when moving a site to a production server. :) So I think I may misunderstand what you mean. Can you clarify?

Link to comment
Share on other sites

Hi Ryan,

I'm working on a relaunch of an existing site which has well over 1000 entries already. For that I build a module which downloads a JSON list of existing articles and rebuilds them for the new site. So I deleted all the articles in the local copy of the new site, moved the templates to the production server and ran the module, so it fills up the site with the most up-to-date data.

My problem is, that the repeater fields never get deleted. I need to delete those manually in the DB, otherwise I get that "no parent assigned" error. But I found those fields in the DB now.

My script for deleting the pages is this:

foreach(wire('pages')->find("template=video,include=all") as $p) { $p->delete();}

Thanks,

thomas

Link to comment
Share on other sites

I'm still confused about why pages are getting deleted as part of the migration. :) You mentioned in your first post that you were getting the error message when adding a page (presumably on the production server?) but in your post directly above it sounds to me like you are referring to an error instead on the staging server, where you were deleting the pages? Apologies for my confusion. Can you abstract your question further, perhaps take it out of this specific context. For instance, I've wondered if your question is this: "When I delete a page with repeater items, the page gets deleted but the repeaters don't. Why?". If that's your question, can you tell me which version of ProcessWire and what other 3rd party modules are installed?

Link to comment
Share on other sites

Oh, sorry for being confusing. I delete those pages to get the most up-to-date data from the old site and because I like my import script better than FTP :) Also I get rid of all the test posts and test comments that way.

My initial question was, how to fix that "no parent assigned" problem. Before anyone answered I figured out it was because the repeaters didn't get deleted. So yeah, I guess to give this whole thread a meaning, my question is: Why don't the repeaters get deleted? :)

I'm using 2.2.9 with  few modules. The biggest ones being module manager and formbuilder.

Thanks Ryan!

t

Link to comment
Share on other sites

Okay I got it. Well, I don't know why the repeater items wouldn't get deleted, but will experiment here to see if I can reproduce it. You might also double check that none of these pages are actually in the trash, rather than deleted. You could also try out the dev branch, but I'm not yet aware of an issue with repeaters in 2.2.9, so not sure that's worth trying. I'll see what I can find here. 

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

×
×
  • Create New...