Relations
Relations can be handled by defining each record with properties referencing the parent record. This is even possible for MM database relations. But there is an easier and shorter way doing it. Relations can be defined as array of combined identifier or objects referencing to the child records. Below are examples for each relation type.
File references
File references require the property
file
to contain a sys_file reference.
Additional properties for sys_ fields can be added.
sys_file:
- identifier: example_jpg
source: 'data/files/example.jpg'
storage: default
folder: /
tt_content:
- identifier: example
pid: "{pages:home}"
CType: image
image:
- file: "{sys_file:example_jpg}"
alternative: "Lorem ipsum"
title: "My fantastic title"
Relations to existing records
Relations to existing records, no matter if its one-to-many, or many-to-many can be defined as an array of combined identifiers.
sys_category:
- identifier: main-category-1
pid: "{pages:home}"
title: Main category 1
- identifier: main-category-2
pid: "{pages:home}"
title: Main category 2
pages:
- identifier: home
pid: "{pages:root}"
title: Homepage
doktype: 1
is_siteroot: 1
categories:
- "{sys_category:main-category-1}"
- "{sys_category:main-category-2}"
Relations to new records
Relations to records that do not exist and can be easily created as relations. The structure is similar to structure creating new records. Just put them below the referencing property.
Note
If no pid is given, that pid from the parent record is used (except if parent record is a page).
pages:
- identifier: home
pid: "{pages:root}"
title: Homepage
doktype: 1
is_siteroot: 1
categories:
sys_category:
- identifier: main-category-1
title: Main category 1
- identifier: main-category-2
title: Main category 2