ArrayCollection <T, O>
Hierarchy
- ArrayCollection
Indexable
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
Type parameters
- T
- O
Parameters
owner: O & Partial<O> & { [EntityRepositoryType]?: unknown; [PrimaryKeyType]?: unknown; __helper?: IWrappedEntityInternal<O, keyof O, string>; __meta?: EntityMetadata<O>; __platform?: Platform }
optionalitems: T[]
Returns ArrayCollection<T, O>
Properties
readonlyowner
Accessors
length
Returns number
Methods
[custom]
Parameters
depth: number
Returns string
[iterator]
Returns IterableIterator<T>
add
Parameters
rest...items: (T | Reference<T>)[]
Returns void
contains
Parameters
item: T | Reference<T>
optionalcheck: boolean
Returns boolean
count
Returns number
getIdentifiers
getItems
Returns T[]
isInitialized
Parameters
fully: boolean = false
Returns boolean
loadCount
Returns Promise<number>
remove
Parameters
rest...items: (T | Reference<T>)[]
Returns void
removeAll
Remove all items from the collection. Note that removing items from collection does necessarily imply deleting the target entity, it means we are disconnecting the relation - removing items from collection, not removing entities from database -
Collection.remove()
is not the same asem.remove()
. If we want to delete the entity by removing it from collection, we need to enableorphanRemoval: true
, which tells the ORM we don’t want orphaned entities to exist, so we know those should be removed.Returns void
set
Parameters
items: (T | Reference<T>)[]
Returns void
toArray
Returns EntityDTO<T>[]
toJSON
Returns EntityDTO<T>[]
Remove specified item(s) from the collection. Note that removing item from collection does necessarily imply deleting the target entity, it means we are disconnecting the relation - removing items from collection, not removing entities from database -
Collection.remove()
is not the same asem.remove()
. If we want to delete the entity by removing it from collection, we need to enableorphanRemoval: true
, which tells the ORM we don’t want orphaned entities to exist, so we know those should be removed.