Using Sulu with existing content from a different CMS #6671
-
What would be the best practice in Sulu, when I want to migrate content from an existing CMS into Sulu. As stated in the documentation this should be possible.
I would like to admin the existing content via Sulu and give my content creators the possibility to copy/edit the existing old articles and create/edit new articles via Sulu. The old content comes from a "News-Website" with about 45.000 articles partly with images. Thanks for any hints! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Hello @brachycera, Not 100% sure if I understand your usecase. If we did migrate currently another CMS example Drupal to Sulu. I added an additional https://symfony.com/doc/current/console.html To read all articles and create via the document manager the Sulu Articles. A short snippet can be found here: Data should be loaded over a \Generator method: https://gist.github.com/alexander-schranz/e526e8cce7755220045132034bbe5687#file-documentmanagerimportcommand-php-L16 And then the document is created or updated: https://gist.github.com/alexander-schranz/e526e8cce7755220045132034bbe5687#file-documentmanagerimportcommand-php-L23 ("createOrUpdate" is nice so you can easily run the command multiple times, I used a mapping table (externalId) to (uuid) to know if I need update (load for update) or create the document). You can then map your old data to your new sulu template via the getStructure()->bind and setExtension methods. See for this: http://docs.sulu.io/en/latest/reference/components/document-manager/fixtures.html This way I imported a lot of data from different Drupals into Sulu. As the drupals I worked with had no structured content just a lot of big text editor content, I did also parse text editors HTML and split it into functional sulu blocks via the DOMCrawler of symfony. |
Beta Was this translation helpful? Give feedback.
-
Hi @alexander-schranz When I understood you correctly, you create a console command to query all articles from the old (drupal) CMS and use the document manager to presist/save all this articles into Sulu? Example: https://gist.github.com/brachycera/8f7ce72e4cd70c4d58fc22a839d97e0c I think one of the puzzle pieces where I need to wrap my head around is, how a single |
Beta Was this translation helpful? Give feedback.
Hello @brachycera,
Not 100% sure if I understand your usecase. If we did migrate currently another CMS example Drupal to Sulu. I added an additional
DBAL Connection
to the other CMS database (mostly it was a SQL dump from prod system). And used the a Symfony Command:https://symfony.com/doc/current/console.html
To read all articles and create via the document manager the Sulu Articles.
A short snippet can be found here:
Data should be loaded over a \Generator method: https://gist.github.com/alexander-schranz/e526e8cce7755220045132034bbe5687#file-documentmanagerimportcommand-php-L16
And then the document is created or updated: https://gist.github.com/alexander-schranz/e526e8cce775522004513…