new DataPortalEvent()
Creates a new enumeration to define the data portal events. Members:
- preFetch, postFetch
- preCreate, postCreate
- preInsert, postInsert
- preUpdate, postUpdate
- preRemove, postRemove
- preExecute, postExecute
- preSave, postSave
Extends
Members
-
<readonly> $name :string
-
The name of the enumeration. The default value is the name of the constructor.
Type:
- string
- Inherited From:
-
<readonly> postCreate :number
-
The event after a data portal create operation.
Type:
- number
- Default Value:
-
- 3
-
<readonly> postExecute :number
-
The event after a data portal execute operation.
Type:
- number
- Default Value:
-
- 11
-
<readonly> postFetch :number
-
The event after a data portal fetch operation.
Type:
- number
- Default Value:
-
- 1
-
<readonly> postInsert :number
-
The event after a data portal insert operation.
Type:
- number
- Default Value:
-
- 5
-
<readonly> postRemove :number
-
The event after a data portal remove operation.
Type:
- number
- Default Value:
-
- 9
-
<readonly> postSave :number
-
The event after a data portal save operation.
Type:
- number
- Default Value:
-
- 13
-
<readonly> postUpdate :number
-
The event after a data portal update operation.
Type:
- number
- Default Value:
-
- 7
-
<readonly> preCreate :number
-
The event before a data portal create operation.
Type:
- number
- Default Value:
-
- 2
-
<readonly> preExecute :number
-
The event before a data portal execute operation.
Type:
- number
- Default Value:
-
- 10
-
<readonly> preFetch :number
-
The event before a data portal fetch operation.
Type:
- number
- Default Value:
-
- 0
-
<readonly> preInsert :number
-
The event before a data portal insert operation.
Type:
- number
- Default Value:
-
- 4
-
<readonly> preRemove :number
-
The event before a data portal remove operation.
Type:
- number
- Default Value:
-
- 8
-
<readonly> preSave :number
-
The event before a data portal save operation.
Type:
- number
- Default Value:
-
- 12
-
<readonly> preUpdate :number
-
The event before a data portal update operation.
Type:
- number
- Default Value:
-
- 6
Methods
-
check(value, message, messageParams)
-
Checks whether the enumeration has an item with the given value. If not, throws an error.
Parameters:
Name Type Argument Description value
number The value to check.
message
string <optional>
Human-readable description of the error.
messageParams
* <optional>
<repeatable>
Optional interpolation parameters of the message.
- Inherited From:
Throws:
Enumeration error: The passed value is not an enumeration item. -
count() → {number}
-
Returns the count of the items in enumeration.
- Inherited From:
Returns:
The count of the enumeration items.
- Type
- number
-
getName(value) → {string}
-
Returns the name of an enumeration item.
Parameters:
Name Type Description value
number The enumeration item that name to be returned of.
- Inherited From:
Throws:
-
Argument error: The value must be a number.
-
Enumeration error: The passed value is not an enumeration item.
Returns:
The name of the enumeration item.
- Type
- string
-
getValue(name) → {number}
-
Returns the value of an enumeration item based on its name.
Parameters:
Name Type Description name
string The enumeration item that value to be returned of.
- Inherited From:
Throws:
-
Argument error: The name must be a non-empty string.
-
Enumeration error: The passed name is not an enumeration item.
Returns:
The value of the enumeration item.
- Type
- number
-
hasMember(value) → {boolean}
-
Determines if the enumeration has an item with the given value.
Parameters:
Name Type Description value
number The value to check.
- Inherited From:
Returns:
True if the value is an enumeration item, otherwise false.
- Type
- boolean
-
hasValue(name) → {boolean}
-
Determines if the enumeration has an item with the given name.
Parameters:
Name Type Description name
string The name of the enumeration item.
- Inherited From:
Returns:
True if the name is an enumeration item, otherwise false.
- Type
- boolean