Template Reference

element-templates

Elements and their structure.

<element-templates>
  <template element='project' use-case='create' selector='new-project'>
    <project>
      <module name="Module">
        <entity name="Enity">
          <field name="id"/>
          <index name="index" type="string" size="255"/>
        </entity>
        <comment caption="comment"/>
      </module>
    </project>
  </template>
</element-template>

element-template

AttributeValues
elementproject, module, region, comment, entity, index, field, association, many-to-many, inheritance, many-to-many-entity, inheritance-parent, inheritance-child
use-casecreate, update, template
selectorprimary-field, new-project, association-field, many-to-many-field, discriminator-field, many-to-many-entity

Selectors

selectorallowed elementused when
project_newprojectnew project is created
primary_fieldfieldproject is imported
association-fieldfieldassociation is created
discriminator-fieldfieldinheritance is created
many-to-many-fieldfieldmany-to-many is created
many-to-manyentitymany-to-many is created

Selector use

primary-field

<template element='field' use-case='create' selector='primary-field'>
  <field name="id" required="true" unique="true" primary="true" auto-increment="true"/>
</template>

Note: Only used for entities without primary key upon project import.

new-project

<template element='project' use-case='create' selector='new-project'>
  <project>
  ...
  </project>
<template/>

association-field

<template element='field' use-case='create' selector='association-field'>
  <field name="{entity-inverse#UL}_id"/>
</template>

discriminator-field

<template element='field' use-case='create' selector='discriminator-field'>
  <field name="{entity-parent#UL}_id"/>
</template>

many-to-many-field

<template element='field' use-case='create' selector='many-to-many-field'>
  <field name="{entity-inverse#UL}_id"/>
</template>

many-to-many

<template element='entity' use-case='create' selector='many-to-many'>
  <orm-attributes>
    <attribute name="isVersionable">true</attribute>
  </orm-attributes>
</template>

Definining many-to-many asociation

<template element='many-to-many' use-case='create'>
  <many-to-many caption="{entity-inverse} to {entity-owner}" mn-entity="{entity-inverse}2{entity-owner}">
    <many-to-many-entity owning-side="true" alias="owner-alias{entity-owner#CFU}"/>
    <many-to-many-entity owning-side="false" alias="inverse-alias{entity-inverse#CFU}"/>
  </many-to-many>
</template>

Dynamic templates

There is one more use case for templates and selectors. It's possibe to define custom templates for dynamic fields. These fields are used as templates in GUI in Entity editor.

As use-case select template, as element enter field and as selector use any custom value, which will be displayed in GUI.

For example to define uuid field template, enter following fragment to your configuration:

<template element="field" use-case="template" selector="uuid">
   <field name="uuid" type="uuid" required="true" unique="true"/>
</template>

Substitution marks

List of all substitution marks available for each element.

ElementSelectorCreateUpdate
projectnoneproject
moduleprojectmodule, project
regionmodulemodule, region
commentmodulemodule, comment
entityproject, moduleproject, module, entity
fieldentityentity, field
fieldassociationentity-inverse,field-inversenone
fieldmany-to-manyentity-inverse,field-inversenone
fieldinheritanceentity-parentnone
indexentityentity, index
inheritance-parententity-parententity-parrent
inheritance-childentity-parent, entity-childentity-parent, entity-child
associationentity-owner, entity-inverse, collection-inverseentity-owner, entity-inverse, collection-inverse
association-fieldentity-owner, field-inversenone
many-to-manyentity-owner, entity-inverse, entity-mnentity-owner, entity-inverse, entity-mn

Local name vs Full name

Because Skipper now handles object names with full namespace, each object capable to hold namespace has two substitution marks. One for local name and one for name including namespace. Currently namespace can be configured for entity, collection and universal-object.

Short (local) object name is stored in entity substitution mark as before. If you want to use full object name, use entity-full mark. The same is true for all other substitution marks which use any of namespaced objects.

For example entity-inverse is "User" and entity-inverse-full is "\Model\Users\User".

Naming styles

KeywordDescription
#CFUCamelCaseFirstUpper
#CFLcamelCaseFirstLower
#ULunder_line
#CFUsCamelCaseFirstUpper in plural form
#CFLscamelCaseFirstLower in plural form
#ULsunder_line in plural form