Version: 2.7
EntityHelper and Decorated Entities
#
Updating entity values with IEntity.assign()When you want to update entity based on user input, you will usually have just plain
string ids of entity relations as user input. Normally you would need to use
EntityManager.getReference()
to create references from each id first, and then
use those references to update entity relations:
Same result can be easily achieved with IEntity.assign()
:
By default, IEntity.assign(data)
behaves same way as Object.assign(entity, data)
,
e.g. it does not merge things recursively. To enable deep merging of object properties,
use second parameter to enable mergeObjects
flag: