Importing content into Pyro

machinedean - 6 months ago

Hi all,

I was just wondering whether there was any known way to import existing content from a website into Pyro. I've been getting to grips with Pyro but haven't noticed any such feature.

If there's no automated way of doing this, I'd be happy to consider writing a script to import via CSV with all the necessary information such as page title, slug, page content, etc. and then import the content into the appropriate database tables.

I've been looking at the tables and trying to understand how everything works together. If anyone has done this before, I'd be grateful for their insight!

Thanks in advanced. Dean

ryanthompson - 6 months ago

Hi Dean!

The biggest thing to look out for in Pyro is entry types. Where an entry (polymorphic Laravel relation) holds custom data for a given Page or Post for example.

That said, what you are looking for are seeders. You can run Laravel seeders or stuff them into an addon but seeders will let you work with the API in a way designed for importing or "seeding" the database. Not sure if you are familiar with those but that's where you should be heading.

From there it's just a matter of using the Repositories by resolving them one way or another or use the models directly and import stuff. Take a look at the pages module, posts, users module, and settings I think too all have seeders in the core addons.

Hope this helps!

machinedean - 6 months ago

Thank you Ryan, this is incredibly helpful - I am familiar with seeders (not sure why I didn't think of this in the first place!)

Sorry if I've missed this but I can't see the pages module on https://www.pyrocms.com/documentation/categories/modules - please can you point me in the right direction?

Thanks again!