AggregateRoot Class
Item Index
Methods
- $include
- $set
- $unset
- clone
- copyWith
- createFactory
- createModel
- createPreferredFactory
- createPreferredRepository
- createPreferredService
- createRepository
- createService
- deprecated
- diff
- enum
- equals
- error
- getDiff
- getFacade deprecated
- getModelProps
- getModule
- getParent
- include
- included
- inherit
- plainClone
- set
- setEnum
- setRoot
- toPlainObject
- unset
- useMemoryResource
Methods
$include
-
[options]
include all relational models and returns new model
Parameters:
-
[options]
Object optional-
[async=true]
Boolean optionalget async values
-
[props]
Array(String) optionalinclude only given props
-
Returns:
new model
$unset
-
prop
unset property and create a new model
Parameters:
-
prop
Stringproperty name
Returns:
this
createFactory
-
modFirstName
create a factory instance 2nd, 3rd, 4th ... arguments are the params to pass to the constructor of the factory
Parameters:
-
modFirstName
String
Returns:
createModel
-
modFirstName
-
obj
-
[options]
create an instance of the given modFirstName using obj if obj is null or undefined, empty object will be created.
Parameters:
-
modFirstName
String -
obj
Object -
[options]
Object optional
Returns:
createPreferredFactory
-
firstName
-
[options]
create a preferred factory instance 3rd, 4th ... arguments are the params to pass to the constructor of the factory
Parameters:
-
firstName
String -
[options]
Object optional-
[noParent=true]
Object optionalif true, stop requiring parent class
-
Returns:
createPreferredRepository
-
firstName
-
[options]
create a preferred repository instance 3rd, 4th ... arguments are the params to pass to the constructor of the repository
Parameters:
-
firstName
String -
[options]
Object optional-
[noParent]
Object optionalif true, stop requiring parent class
-
Returns:
createPreferredService
-
firstName
-
[options]
create a preferred service instance 3rd, 4th ... arguments are the params to pass to the constructor of the factory
Parameters:
-
firstName
String -
[options]
Object optional-
[noParent=true]
Object optionalif true, stop requiring parent class
-
Returns:
createRepository
-
modFirstName
create a repository instance 2nd, 3rd, 4th ... arguments are the params to pass to the constructor of the repository
Parameters:
-
modFirstName
String
Returns:
createService
-
modFirstName
create a service instance 2nd, 3rd, 4th ... arguments are the params to pass to the constructor of the service
Parameters:
-
modFirstName
String
Returns:
deprecated
-
methodName
-
message
Show indication message of deprecated method
Parameters:
-
methodName
String -
message
String
Returns:
diff
-
plainObj
-
[options]
Get diff props
Parameters:
-
plainObj
Any -
[options]
Object optional-
[ignores]
Array(String) optionalprop names to skip checking diff
-
Returns:
enum
()
Object(key: String => Number)
public
Returns:
error
-
reason
-
[message]
create instance of DomainError
Parameters:
-
reason
Stringreason of the error
-
[message]
String optional
Returns:
getDiff
-
plainObj
-
[options]
Get diff prop values
Parameters:
-
plainObj
Any -
[options]
Object optional-
[ignores]
Array(String) optionalprop names to skip checking diff
-
Returns:
getParent
()
Function
get parent class
Returns:
include
-
[options]
include all relational models if not set
Parameters:
-
[options]
Object optional-
[async=true]
Boolean optionalget async values
-
[props]
Array(String) optionalinclude only given props
-
Returns:
self
included
()
Boolean
Check if all subentities are included.
Returns:
inherit
-
anotherModel
inherit value of anotherModel
Parameters:
-
anotherModel
BaseModel
Returns:
this
plainClone
()
Object
public
clone the model as a plain object
Returns:
set
()
set value to prop set memories
setEnum
-
prop
-
value
set enum value
Parameters:
-
prop
String -
value
String | Number
setRoot
()
protected
toPlainObject
()
Object
create plain object without relational entities plainize memoryResources
Returns:
plainObject
unset
-
prop
unset property
Parameters:
-
prop
Stringproperty name
Returns:
this
useMemoryResource
-
modelName
get or create a memory resource to save to @memories Only called from LocalRepository
Parameters:
-
modelName
String
Returns:
Properties
id
String | Number
primary key for the model
isRoot
Boolean
static
is root (to identify RootInterface)
memories
Object(MemoryResource)
key: modelName, value: MemoryResource