-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
Allow option to exclude purged tables/views #330
Conversation
Allow php 8
The bundle is already compatible with it.
Allow persistence 2
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.
Please remove all .idea
files from your PR.
This looks like the kind of thing that should be managed with configuration: why would you want to sometimes exclude tables from purge, some other tables not? |
Maybe i don't know the most simple configuration right, but for me, with command parameter it's easy to use. On first usage, we want all fixtures and imports but after when we load only fixtures, we don't want delete cities because it's just "reference" data and make long time to import. What do you think ? |
One example are database views mapped to entities, these tables are composed from other tables and purging fails because it tries to truncate them. |
My group would really like this PR merged! I have tested it locally and it works great.
We scaffold our development environment database with a copy of some production data such as users, departments, projects, and all their relationships. Our enterprise organization is large and re-creating all these relationships in dev fixtures is too tedious. We purge most production data but keep data from a few tables. And a few tables even select batches of records to keep while purging the rest. Of course this is custom logic we don't expect DoctrineFixturesBundle to support. We have already created our own Symfony Command that decorates logic around doctrine:fixtures:load, as we recognize "composition over inheritance" when integrating third-party code. Our command first does some custom logic, then programmatically calls doctrine:fixtures:load, then does more custom logic after fixture data exists. Accepting this PR means our custom command can continue programmatically calling doctrine:fixtures:load like this:
There are no other seams available in doctrine:fixtures:load for us to change how purging is done, unless we fork and re-implement doctrine:fixtures:load. There is no seams to inject custom behavior for purging using ORMPurger, short of hacking up Doctrine metadata. As of today doctrine:fixtures:load does The only alternative I can think of is
You don't want to hassle with that. Accepting this PR to support custom table purging is much easier for library maintenance and fits most use cases. @greg0ire Is there anything else stopping this PR from being merged? Tests? Documentation? Please let me know and I'll gladly PR any fixes to implement them and get this merged in. |
Ahh, I didn't see that master branch supports a custom purger. We could work with that solution once it's tagged in a stable release! Thanks for all your hard work. |
This PR should target |
Apparently there are conflicts, maybe with the custom purger you were talking about. I have some maintenance work to do here, I'll do it and then I will release 3.4.0 |
Looks like this PR is no longer needed because LoadDataFixturesDoctrineCommand in master supports option |
Let's close then. I'm working on fixing the build at #334 |
Hi,
I would like add small argument to manage excluded purge tables/views.
I don't know how i can add test simply ?
Can be related with #320 ?