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 values for a property. 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 should created by the relations can also be defined a a simplified version. The definition is done like every other records but as a property of the parent record.
Note
If no pid is given, that pid from the parent record is used (except is 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