wiki:quintagroup.transmogrifier/ContentTypeChange

Version 5 (modified by chervol, 13 years ago) (diff)

--

Changing the ContentType of object while migrating content with quintagroup.transmogrifier

Type conversion can be done on content import.

Item import process consists of two steps:

  1. the object has to be created
  2. object updated with field values and other attributes

The correction for first step can be done with substitution pipeline, second - with xslt pipeline. Alternatively you can use datacorrector pipeline but it will require registering specific corrector adapters.

The quintagroup.transmogrifier.substitution? blueprint used in tandem with quintagroup.transmogrifier.xslt?

In your import configuration (import.cfg) insert substitution exactly before the constructor pipeline, then xslt goes. And it should look like:

pipeline =
    ...
    substitution
    constructor
    xslt
    ...

We going to replace Event with News Item. The item's key for content_type is _type and the old value is saved under _old_type.

[substitution]
blueprint = quintagroup.transmogrifier.substitution
key = _type
Event = News Item

In xslt section we also have to mention the keys in from-key and the to-key.

[xslt]
blueprint = quintagroup.transmogrifier.xslt
source = marshall
from-key = _old_type
to-key = _type