You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Undefined entity - in subscribers after and before update events #2809
Same here - PostgreSQL & TypeORM 0.2.8 - looks like this is "by design"... The UpdateQueryBuilder is not passing any argument for entity or databaseEntity to the method responsible for broadcasting Events...
Btw I think there is a mistake in the definition of UpdateEvent as entity and databaseEntity should be optional (entity?: <type> instead of entity: <type>)
Related to #2246 (contains answers from Pleerock).
What could be possible is to pass the "valuesSet" from UpdateQueryBuilder, but this isn't the entity, properly speaking.
its not a bug. I told it probably hundred of times probably that people should use save if they want to have all orm functionality. update was supposed as "just execute update query and thats it" - limited functionality with maximal performance. Maximal performance means no additional selects, no additional selects means no databaseEntity set in subscriber event.
@VinceOPS yes we can update signature. Feel free to pr ;)
Reacted by Nahuel Vazquez, tailtZigvy, Brrruski, Hudson and vinicius
This is definitely a bug that event.entity typed as always not undefined, but SOMETIMES its undefined.
Why you are calling subscribers/listeners for this situation at all (when update/increment without save())?
I've a bug because this is not obvious.
Reacted by Alex Hutsau, Pascal Ehlert, Diego Guzmán, Rich Choy, Jeffyter Saraiva, Scott Prue, Max Sannikov, Thalyson Rodrigues, MRAmeli, Pedro and 8 more
Activity
ChangJoo-Park commentedon Oct 20, 2018
+1 here
same environment.
VinceOPS commentedon Dec 10, 2018
Same here - PostgreSQL & TypeORM 0.2.8 - looks like this is "by design"... The
UpdateQueryBuilderis not passing any argument forentityordatabaseEntityto the method responsible for broadcasting Events...Btw I think there is a mistake in the definition of
UpdateEventasentityanddatabaseEntityshould be optional (entity?: <type>instead ofentity: <type>)Related to #2246 (contains answers from Pleerock).
What could be possible is to pass the "valuesSet" from UpdateQueryBuilder, but this isn't the entity, properly speaking.
pleerock commentedon Jan 7, 2019
its not a bug. I told it probably hundred of times probably that people should use
saveif they want to have all orm functionality.updatewas supposed as "just execute update query and thats it" - limited functionality with maximal performance. Maximal performance means no additional selects, no additional selects means nodatabaseEntityset in subscriber event.@VinceOPS yes we can update signature. Feel free to pr ;)
dhammma commentedon Jul 23, 2020
This behavior very not obvious for me
rskvazh commentedon Aug 14, 2020
This is definitely a bug that event.entity typed as always not undefined, but SOMETIMES its undefined.
Why you are calling subscribers/listeners for this situation at all (when update/increment without save())?
I've a bug because this is not obvious.
fix(mediarequest): refactor to .save() instead of .update() for TypeORM