Versions Compared

Key

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

...

You can also enforce data integrity by using validators.

back to top

Structure

All model entites used by system are defined in XML files. Every plugin has one directory model which contains xml files with definition of entities used by this plugin.

Name of defined entity must be unique within the plugin scope.

Code Block
languagexml
themeEclipse
linenumberstrue
<model name="sampleModel"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://schema.qcadoo.org/model"
    xsi:schemaLocation="http://schema.qcadoo.org/model http://schema.qcadoo.org/model.xsd">

    <fields>

        // HERE YOU PUT FIELD DEFINITIONS

    </fields>

    <hooks>

        // HERE YOU PUT HOOK DEFINITIONS

    </hooks>

    // HERE YOU PUT IDENTIFIER

</model>

...

- name - is a name of defined entity, it must be unique within the plugin scope

Structure of field definition

...

Code Block
languagexml
themeEclipse
linenumberstrue
<fieldType options>

    // HERE YOU PUT VALIDATORS

</fieldType>

...

- fieldType - is a type of field
- options - options of field

Field types

Insert excerpt
QCDMESDOC:Model Fields
QCDMESDOC:Model Fields
nopaneltrue

...

Code Block
languagexml
themeEclipse
linenumberstrue
<validatorType validatorOptions />

Where:

- validatorType - type of validator

...

Validator types

Insert excerpt
QCDMESDOC:Model Validators
QCDMESDOC:Model Validators
nopaneltrue

...

Code Block
languagexml
themeEclipse
linenumberstrue
<eventName class="className" method="methodName"<hookType hookOptions />

Where:

- eventName - name of event (see below)

- className - definies path and name to object with your custom method

- methodName - definies custom method name

Hook types

Insert excerpt
QCDMESDOC:Model Hooks
QCDMESDOC:Model Hooks
nopaneltrue

...

Role of entity identifier is to convert entity defined in model to a simple text (see expressions overview). It is used for example when showing operation messages. If not defined, system will use field 'number' of defined entityIf "expression" is givet it is used to evaluate identifier, otherwise "number" field will be taken.

Code Block
languagexml
themeEclipse
linenumberstrue
<identifier expression="#number + ' - ' + #name"/>

Where:

...

Examples

These examples definies three simple entities.

...