-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
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
Encrypted fields are constantly being persisted to the Database even when they aren't being modified. #24
Comments
Looks like someone fixed this |
@jayesbe |
@numediaweb ive moved on to a fork of this project. https://github.com/michaeldegroot/DoctrineEncryptBundle |
This change doesn't fix this issue. From what I see the fork also doesn't fix this? @jayesbe |
@Henridv I am using the degroot fork however I do have a fork of my own with the fix merged. absolute-quantum/DoctrineEncryptBundle@master...Indinuity:degroot |
@jayesbe However, your fix only reduces the encrypt/decrypt operations. All entities with encrypted properties fetched from the database will be marked as 'dirty' in the entity manager. |
@Henridv interesting.. What happens if you flush() only the entities you are modifying? I don't know when I'll have time to look into it.. if you get a chance to look into it further or come across a better fix let me know. |
@jayesbe, @Henridv I think I found a workaround using the "deferred explicit" tracking policy (See doctrine documentation). Setting deffered explicit tracking policy to all entities containing encrypted fields will prevent them from being automatically persisted on flush. They will be persisted only if persist() is explicitely called on each instance you want to save in DB. |
@jriboux are you working on an PR ? |
Anytime I perform an $em->flush(); An Entity that was loaded which contains encrypted fields will show up as an UPDATE statement in the log. There are no changes to the entity. The fields aren't even used. The UPDATE should not occur.
Aside from this, My understanding of the code is that the values are decrypted as soon as the entity is loaded.. shouldn't they only be decrypted when some encrypted field is retrieved from the Entity ?
The text was updated successfully, but these errors were encountered: