New in package 166
Syntax
var entity = repository.get(id);
Properties
Property | Type | Description |
---|---|---|
[$id] | id type or Object | The entity id. |
[$idValue] | id type | The entity id value. |
[$description] | string | The entity description. |
$type | object | An object describing the entity type. |
[$isNew] | bool | True if entity has not been committed to the database yet. |
[$isDeleted] | bool | True if entity has been deleted from the database. |
[$isDirty] | bool | True if entity has to be saved. |
[$fields] | [record] | Fields loaded from/to be saved into the database. |
[$oldValues] | [record] | Original field values from the database. Empty for newly created entity. |
[$changedValues] | [record] | Changed values. |
$tags | collection | A collection of tags. |
[$folder] | entity or null | A reference to folder entity this document entity belongs to. |
$timezone | Time.Timezone | An object time zone. |
Methods
Data
$schema(options) | Specifies which data to send to the client and to which fields to apply it when it comes back. |
[$get]( fieldName ) | Returns value of the requested field; fieldName is case-insensitive. |
[$set]( fieldName, value ) | Sets value of the specified field; fieldName is case-insensitive. |
[getData]([schema]) | |
[setData](data [, schema]) |
Events
Method | Description |
---|---|
[on].event(function event(entity) { ... }) [on](event, function event(entity) { ... }) |
Adds a listener for an entity event. |
Event | Description |
---|---|
[clone] | Fired when the [Database.clone](entity) method is called. |
[getData] | |
[setData] | |
[changed] | |
[save] | Fired when the entity is about to be saved. |
[saved] | Fired when the entity has been saved. Don't modify entities from this event listener. |