BelongsTo Field
Overview
This field represents entity in relation "many-to-one" to this model.
Common Attributes
name | type | required | default value | description |
---|---|---|---|---|
name | string | yes | none | Name  of the field, must be unique in this model scope. |
readonly | boolean | no | false | If true this field cannot be change by user. |
required | boolean | no | false | If true this field will be required (validator and "not-null" database's contraint will be added). |
copyable | boolean | no | true (except hasMany, manyToMany and tree fields) | If true value of this field will be copied during entity copy. Should be set to false for unique (see above) fields (except string and text). |
persistent | boolean | no | true | If true this field will be stored in database. |
Attributes
name | type | required | default value | description |
---|---|---|---|---|
model | string | yes | none | Name of corresponding model related to this field. |
plugin | string | no | none | Name of plugin where the corresponding model belongs. |
lazy | boolean | no | true | When 'true', entity related to this model will be pulled from database when value of this field is first read. When 'false', corresponding entity is pulled in the same time as entity described in this model. |
unique | boolean | no | false | If true this field will be unique (validator with case insensitive). |
Example
<belongsTo name="order" model="order" />