Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt
hiddentrue

tree - tree-structured one-to-many relation.

Overview

This field represents tree-structured set of entities related to this model. This is an extention of "hasMany" field.

Common Attributes

Insert excerpt
Common Model Field Attributes
nopaneltrue
Common Model Field Attributes

Attributes

name

type

required

default value

description

model

string

yes

none

Name of corresponding model related to this field.

joinField

string

yes

none

name of field from corresponding model that will be used as join field. Type of this field must be "belongsTo".

plugin

string

no

none

Name of plugin where the corresponding model belongs.
If empty it is assumed that corresponding model belongs to the same plugin that field's model.

cascade

nullify/delete

no

none

Desribes behaviour when the entity is deleted: 'delete' means that all entities related through this field will be also deleted, 'nullify' means that field value will be set to null.

copyable

boolean

no

false

When this option is set tu 'true', all entities related to defined entity by this field will be copied when main entity is copied, so new entity creaded by copy operation will be related to copied entities instead of oryginal ones.

Example

Code Block
themeEclipse
languagexmlthemeEclipse
linenumberstrue

<tree name="directories" model="directory" joinField="fileSystem" />

Model directory must have at least these five fields (name of the field fileSystem must match tree's joinField):

Code Block
themeEclipse
languagexmlthemeEclipse
linenumberstrue

<belongsTo name="fileSystem" model="fileSystem" required="true" />
<hasMany name="children" model="directory" joinField="parent" cascade="delete" copyable="true" />
<belongsTo name="parent" model="directory" />
<priority name="priority" scope="parent" />
<string name="nodeNumber" />

Field nodeNumber contains user friendly information about position of node in tree.
See TreeNumberingService JavaDoc to get information about how to generate  numbering tree nodes.