ProductCollectionService
internal.internal.ProductCollectionService
Provides layer to manipulate product collections.
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>manager_
EntityManagerRequiredproductCollectionRepository_
Repository<ProductCollection> & { findAndCountByDiscountConditionId: Method findAndCountByDiscountConditionId }RequiredproductRepository_
Repository<Product> & { _applyCategoriesQuery: Method _applyCategoriesQuery ; _findWithRelations: Method _findWithRelations ; bulkAddToCollection: Method bulkAddToCollection ; bulkRemoveFromCollection: Method bulkRemoveFromCollection ; findOneWithRelations: Method findOneWithRelations ; findWithRelations: Method findWithRelations ; findWithRelationsAndCount: Method findWithRelationsAndCount ; getCategoryIdsFromInput: Method getCategoryIdsFromInput ; getCategoryIdsRecursively: Method getCategoryIdsRecursively ; getFreeTextSearchResultsAndCount: Method getFreeTextSearchResultsAndCount ; isProductInSalesChannels: Method isProductInSalesChannels ; queryProducts: Method queryProducts ; queryProductsWithIds: Method queryProductsWithIds }RequiredtransactionManager_
undefined | EntityManagerRequiredEvents
objectRequiredEvents.CREATED
stringRequiredEvents.DELETED
stringRequiredEvents.PRODUCTS_ADDED
stringRequiredEvents.PRODUCTS_REMOVED
stringRequiredEvents.UPDATED
stringRequiredAccessors
activeManager_
Protected
get
activeManager_(): EntityManager
Returns
EntityManager
EntityManager
EntityManagerRequiredInherited from
TransactionBaseService.activeManager_
Methods
addProducts
addProducts(collectionId
, productIds
): Promise
<ProductCollection
>
Parameters
collectionId
stringRequiredproductIds
string[]RequiredReturns
Promise
<ProductCollection
>
atomicPhase_
Protected
atomicPhase_<TResult
, TError
>(work
, isolationOrErrorHandler?
, maybeErrorHandlerOrDontFail?
): Promise
<TResult
>
Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
<TResult
>
Promise
Promise<TResult>RequiredInherited from
TransactionBaseService.atomicPhase_
create
create(collection
): Promise
<ProductCollection
>
Creates a product collection
Parameters
Returns
Promise
<ProductCollection
>
created collection
delete
delete(collectionId
): Promise
<void
>
Deletes a product collection idempotently
Parameters
collectionId
stringRequiredReturns
Promise
<void
>
Promise
Promise<void>Requiredlist
list(selector?
, config?
): Promise
<ProductCollection
[]>
Lists product collections
Parameters
selector
Selector<ProductCollection> & { discount_condition_id?: string ; q?: string }config
objectconfig.skip
numberRequiredconfig.take
numberRequiredReturns
Promise
<ProductCollection
[]>
the result of the find operation
listAndCount
listAndCount(selector?
, config?
): Promise
<[ProductCollection
[], number
]>
Lists product collections and add count.
Parameters
selector
ListAndCountSelectorconfig
FindConfig<ProductCollection>Returns
Promise
<[ProductCollection
[], number
]>
the result of the find operation
removeProducts
removeProducts(collectionId
, productIds
): Promise
<void
>
Parameters
collectionId
stringRequiredproductIds
string[]RequiredReturns
Promise
<void
>
Promise
Promise<void>Requiredretrieve
retrieve(collectionId
, config?
): Promise
<ProductCollection
>
Retrieves a product collection by id.
Parameters
collectionId
stringRequiredconfig
FindConfig<ProductCollection>Returns
Promise
<ProductCollection
>
the collection.
retrieveByHandle
retrieveByHandle(collectionHandle
, config?
): Promise
<ProductCollection
>
Retrieves a product collection by id.
Parameters
collectionHandle
stringRequiredconfig
FindConfig<ProductCollection>Returns
Promise
<ProductCollection
>
the collection.
shouldRetryTransaction_
Protected
shouldRetryTransaction_(err
): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanInherited from
TransactionBaseService.shouldRetryTransaction_
update
update(collectionId
, update
): Promise
<ProductCollection
>
Updates a product collection
Parameters
collectionId
stringRequiredReturns
Promise
<ProductCollection
>
update collection
withTransaction
withTransaction(transactionManager?
): ProductCollectionService
Parameters
transactionManager
EntityManager