Currently, the transaction object in Fireorm only exposes a getRepository method, which returns a TransactionRepository. This limits the ability to use custom repositories within transactions, as there is no getCustomRepository method available.
Steps to Reproduce
Attempt to use a custom repository within a transaction in Fireorm.
Notice that the transaction object does not provide a getCustomRepository method.
Expected Behavior
Ability to use custom repositories within transactions by providing a getCustomRepository method on the transaction object.
Actual Behavior
The transaction object only exposes a getRepository method, which returns a TransactionRepository.
Acceptance Criteria
Implement a getCustomRepository method on the transaction object.
Ensure the custom repositories within transactions receive the necessary special treatment.
Add unit tests to verify the functionality of custom repositories in transactions.
Additional Context
December 31, 2020: Initial issue raised about the lack of support for custom repositories in transactions.
January 11, 2021: Acknowledgment of the issue and discussion about the special treatment required for transaction repositories.
March 7, 2021: Expression of interest in supporting this feature, with an invitation for contributions.
Proposed API Changes
Implement getCustomRepository Method:
Add a getCustomRepository method to the transaction object to support custom repositories in transactions.
class Transaction {
// Existing methods...
getCustomRepository<T>(entity: EntityConstructor<T>): CustomRepository<T> {
const repository = getCustomRepository(entity);
// Apply necessary special treatment for transaction
return new CustomTransactionRepository(repository, this);
}
}
Special Treatment for Transaction Repositories:
Ensure that custom repositories within transactions receive the necessary special treatment.
Description
Currently, the transaction object in Fireorm only exposes a
getRepository
method, which returns aTransactionRepository
. This limits the ability to use custom repositories within transactions, as there is nogetCustomRepository
method available.Steps to Reproduce
getCustomRepository
method.Expected Behavior
Ability to use custom repositories within transactions by providing a
getCustomRepository
method on the transaction object.Actual Behavior
The transaction object only exposes a
getRepository
method, which returns aTransactionRepository
.Acceptance Criteria
getCustomRepository
method on the transaction object.Additional Context
Proposed API Changes
Implement getCustomRepository Method:
getCustomRepository
method to the transaction object to support custom repositories in transactions.Special Treatment for Transaction Repositories:
Unit Tests:
Example Implementation
Original Issue