-
-
Notifications
You must be signed in to change notification settings - Fork 205
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
Support for custom purgers #307
Conversation
Please add some docs |
Done |
Please have a look at the test suite, it fails. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job with the commits!
Still working on solving the deprecation warnings |
Alright, here we are:
I guess we are ready to go Thanks for the collaboration, @greg0ire |
When running the suite in 1 out of 1000 times I a previous container was incorrectly reused
@greg0ire meditating over it a bit, I've moved more responsibilities into the factory and added a warning if a user passes an unknown purger so that we are not falling back to the default factory silently. |
Tested this in a project and it works. Found and fixed another bug (truncate mode was not correctly passed). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few small return type format changes in the docs.
Custom purgers can now specified by implementing a PurgerFactory and registering it with a tag "doctrine.fixtures.purger_factory" and specifying an alias. Co-Authored-By: Claudio Zizza <859964+SenseException@users.noreply.github.com>
@SenseException done |
Thanks @lstrojny ! |
This PR allows users to specify a custom purger (as previously requested in #116).
As a user, I can register my custom purger factory, that implements
createForEntityManager(?string $emName, EntityManagerInterface $em, array $excluded = [], bool $purgeWithTruncate = false) : PurgerInterface
with the tagdoctrine.fixtures.purger_factory
and somealias
and then run the command with--purger=$alias
. If theORMPurger
is used--purge-exclusions
, a list of tables that ought to not be purged, are supported.