Coder Social home page Coder Social logo

Comments (4)

dvdknaap avatar dvdknaap commented on May 24, 2024 1

@dvdknaap auditor relies on Doctrine changesets to keep track of what was added/updated/deleted/associated/dissociated.

When several onFlush subscribers are registered (which is the case here, there are at least 2 subscribers: auditor's one and yours), if subscribers alter entities and try to persist them but do not explicitly tell Doctrine to update the computed changeset, then changes applied by one subscriber may not/won't be available/visible to other subscribers.

This is discussed in Doctrine documentation

Changing primitive fields or associations requires you to explicitly trigger a re-computation of the changeset of the affected entity. This can be done by calling $unitOfWork->recomputeSingleEntityChangeSet($classMetadata, $entity).

Do you explicitly trigger a re-computation of the changeset in your subscriber?

Hi, thanks for your reply.

I know i'm using unit of works recomputeSingleEntityChangeSet function to tell doctrine there is an change.

I found the issue apparently is unitOfWork is getting new data from the database and triggers postLoad (Events::postLoad) which makes the data readable again because it's an select query so i have to find a way to manual do this so unitOfWork doesn't see a change everytime.

Now it also updating different 'encrypted' entity colomns because it's comparing it with the plain text value that postLoad provided it so this issue it not in your code but in doctrine because of this i shall close this issue

from auditor.

DamienHarper avatar DamienHarper commented on May 24, 2024

@dvdknaap did you solve your issue on your own?

from auditor.

dvdknaap avatar dvdknaap commented on May 24, 2024

@DamienHarper
Hadn't test the priority setting yet but it's still not working unfortionatly :(

services.yaml

  App\EventSubscriber\EncryptSubscriber:
    tags:
      - name: 'doctrine.event_subscriber'
        priority: 9999

But in the database it still gives plain text.
{"new":"5yTc8wChiQyTEXi1MtOO5A==","old":"testName"}

"old" should have a base64 string

from auditor.

DamienHarper avatar DamienHarper commented on May 24, 2024

@dvdknaap auditor relies on Doctrine changesets to keep track of what was added/updated/deleted/associated/dissociated.

When several onFlush subscribers are registered (which is the case here, there are at least 2 subscribers: auditor's one and yours), if subscribers alter entities and try to persist them but do not explicitly tell Doctrine to update the computed changeset, then changes applied by one subscriber may not/won't be available/visible to other subscribers.

This is discussed in Doctrine documentation

Changing primitive fields or associations requires you to explicitly trigger a re-computation of the changeset of the affected entity. This can be done by calling $unitOfWork->recomputeSingleEntityChangeSet($classMetadata, $entity).

Do you explicitly trigger a re-computation of the changeset in your subscriber?

from auditor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.