Skip to content

Undefined entity - in subscribers after and before update events #2809

Closed

Description

@darekf77

Issue type:

[x ] bug report
Database system/driver:

[x] sqlite

TypeORM version:

[ x] `0.2.7

Steps to reproduce or a small repository showing the problem:

Simple example here: https://github.com/darekf77/typeorm-sqlite-error-example

Activity

  1. ChangJoo-Park commented on Oct 20, 2018

    @ChangJoo-Park
    Contributor

    +1 here
    same environment.

  2. VinceOPS commented on Dec 10, 2018

    @VinceOPS
    Contributor

    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.

  3. pleerock commented on Jan 7, 2019

    @pleerock
    Member

    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 ;)

  4. dhammma commented on Jul 23, 2020

    @dhammma

    This behavior very not obvious for me

  5. rskvazh commented on Aug 14, 2020

    @rskvazh

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions