Skip to content
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

Missing SoftDeleteableListener #10

Merged
merged 1 commit into from
Nov 12, 2014
Merged

Missing SoftDeleteableListener #10

merged 1 commit into from
Nov 12, 2014

Conversation

xpavp03
Copy link
Contributor

@xpavp03 xpavp03 commented Nov 12, 2014

No description provided.

mishak87 added a commit that referenced this pull request Nov 12, 2014
Missing SoftDeleteableListener
@mishak87 mishak87 merged commit e8cc433 into rixxi:master Nov 12, 2014
@mishak87
Copy link
Contributor

Thank you!

@mishak87
Copy link
Contributor

I just realized I might have done stupid thing, please test it and report back if it works. Thanks!
I am not sure if there was more to it than just missing config as suggested by separate issue #1.

@xpavp03
Copy link
Contributor Author

xpavp03 commented Nov 12, 2014

It works for me.

SoftDeleteable has two functions:

  1. adds deletedAt IS NULL to SELECTs (deletedAt being what ever you name it)
  2. replaces DELETE triggered by $em->delete($entity) at flush time with UPDATE of deletedAt

Both work for me when I:

  1. register the filter in config.neon using the doctrine: / filters: section (as you mention in your readme)
  2. enable the filter in BasePresenter with $em->getFilters()->enable('soft-deleteable')
  3. add the listener to my config.neon as shown in this patch

Later I realized that item 3 should better go into your gedmo.neon, so I proposed this change. I also moved it there in my project so I verified that it works when placed there.

Your readme doesn't mention that the filter needs to be enabled but it's nothing specific to your code. All Doctrine filters are disabled by default. I'm not sure what issue #1 refers to.

@mishak87
Copy link
Contributor

Thanks it might have been a legacy issue which has been fixed in kdyby/events or gedmo AFAIK circular reference and/or issue with storing entity to database conflicting with other gedmo features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants