Is there any way to prevent purging one table when using Symfony Fixtures Bundle?
Symfony Doctrine fixtures - do not purge all tables
3.6k Views Asked by damlys At
2
There are 2 best solutions below
0
Jasonoro
On
It's a bit late however I created a PR that allows the use of a --exclude-table option. If/Once it has been merged you can use the following syntax:
php bin/console doctrine:fixtures:load --exclude-table=table_name --exclude-table=table_2_name
which will run the fixtures as normal but won't purge table_name or table_2_name.
Related Questions in SYMFONY
- Key provided is shorter than 256 bits, only 64 bits provided
- Troubleshooting form submission in PrestaShop's hookDisplayAdminProductsExtra module
- Symfony Framework - Route cannot be found even if it is defined in Controller
- Opening modal through Update button with specified ID using ajax
- Can't revert a Loggable entity because of a Doctrine repository error
- Symfony form type option issues
- How to redirect all shopware logs (monolog) including plugins (bundles) to single target like a file or stderr
- Serialization Symfony return empty array
- scheb/2fa not detected/working on my project
- Dynamically Adding Serialization Groups to Properties in Symfony 6.4 Using Traits
- symfony No identifier/primary key specified for Entity "App\Entity\Etablissement"
- Symfony basic auth doesn't work specifically in test
- Laravel 11 upgrade with Laravel Nova v.26.4 and Symfony/finder 7
- Does Symfony need the user to be online inorder to handle messages in the messenger queue?
- How to temporary disable Xdebug for cache/container building code, but that it remains enabled for the rest of the execution?
Related Questions in DOCTRINE
- Can't revert a Loggable entity because of a Doctrine repository error
- PHP ORM DOCTRINE
- How can I get the current entity values from loadClassMetadata?
- Doctrine "matching" method on EXTRA_LAZY ManyToMany relation make invalid SQL request
- Create a database in Symfony
- SSL connection mysql symfony 7
- Troubleshooting @ParamConverter Issue in Symfony
- symfony doctrine uuid on maria not working
- How to get fresh document after persisting and flushing it in Doctrine ODM?
- Doctrine Command 'doctrine:mapping:import' is not defined in Symfony project
- Issues with the compatibility of getRepository() function in MongoDB DocumentManager and Persistence ManagerRegistry
- Aggregation Query in Symfony & MongoDB
- Doctrine - add custom info to column entity
- Cannot clear APCu Cache from Console, it's shared in the Webserver memory and not accessible from the CLI
- Symfony prevent operation on entity using listeners
Related Questions in FIXTURES
- Ruby on Rails deleting fixtures with foreign keys
- How can I setup Minitest fixtures to test Apartment using postgres schemas
- Speedup symfony2 fixtures loading in tests with security.encoder_factory
- Rails Fixtures with BCrypt
- In a Django test, how to load a sample JSON file?
- How to create a Model object in Yii PHPUnit test without a fixture?
- Rails style fixture deserializer for c#
- How to use concurrency in a single rails test?
- Symfony Doctrine fixtures - do not purge all tables
- Rails Test Case: Rather than global fixtures is there any way to create fixtures for specific test case?
- Rails 4: Error on collection through association in (TestCase) controller index action test
- Pytest: Carthesian product of dependent fixtures
- Grails Fixtures Plugin: How do I purge a fixture after running one test case with it?
- Rails fixtures — Incrementing an ID attribute automatically?
- Where to place Fixtures that are not associated with a model in Rails
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
If you do the purging in a controller, you can write code like this:
If you want do the purging in some class that does not have access to entity manager, you'll have to inject it in the constructor of the class, or as a parameter of the purging method. A rest of the code should look similar like before, only construction of the purger should look like this: