We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Within a transaction, the { data } object provided should also be provided to the beforeTransactionCommit, afterTransactionCommit, etc subscribers
transaction
{ data }
beforeTransactionCommit
afterTransactionCommit
When calling method like insert, update, save and providing OrmOptions, for example:
insert
update
save
OrmOptions
const myEntity = new MyEntity({ id: 1, status 1 }); await manager.transaction(async (manager) => { await queryRunner.insert(myEntity, { someData: true }); await queryRunner.update({ ...myEntity, status: 2 }); });
This is what should be happening
/** * Called after entity insert. */ afterInsert(event: InsertEvent<any>) { console.log(`AFTER ENTITY INSERTED: `, event.queryRunner.data) // ✅ } /** * Called after entity update. */ afterUpdate(event: UpdateEvent<any>) { console.log(`AFTER ENTITY UPDATED: `, event.queryRunner.data) // ✅ } /** * Called after transaction commit. */ afterTransactionCommit(event: TransactionCommitEvent) { console.log(`AFTER TRANSACTION COMMITTED: `, event.queryRunner.data) // ✅ }
This is what is happening
/** * Called after entity insert. */ afterInsert(event: InsertEvent<any>) { console.log(`AFTER ENTITY INSERTED: `, event.queryRunner.data) // ✅ } /** * Called after entity update. */ afterUpdate(event: UpdateEvent<any>) { console.log(`AFTER ENTITY UPDATED: `, event.queryRunner.data) // ✅ } /** * Called after transaction commit. */ afterTransactionCommit(event: TransactionCommitEvent) { console.log(`AFTER TRANSACTION COMMITTED: `, event.queryRunner.data) // ❌ }
Here's a PR with the test that shows the issue (if you remove the fix it'll fail) https://github.com/typeorm/typeorm/pull/10151/files
No response
Yes, I have the time, and I know how to start.
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Issue description
Within a
transaction
, the{ data }
object provided should also be provided to thebeforeTransactionCommit
,afterTransactionCommit
, etc subscribersWhen calling method like
insert
,update
,save
and providingOrmOptions
, for example:Expected Behaviour
This is what should be happening
Actual Behavior
This is what is happening
Steps to reproduce
Here's a PR with the test that shows the issue (if you remove the fix it'll fail)
https://github.com/typeorm/typeorm/pull/10151/files
My Environment
Additional Context
No response
Relevant Database Driver(s)
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, and I know how to start.
The text was updated successfully, but these errors were encountered: