Open maximmandrik opened 2 years ago
Please provide a stack trace
There are no other way to disable the FK constraint in doctrine:fixtures:load
command when you want to refresh the database, so have to use this way instead:
From https://github.com/doctrine/DoctrineFixturesBundle/issues/50
php bin/console doctrine:schema:drop --force
php bin/console doctrine:schema:update --force
php bin/console doctrine:fixtures:load
Depending on you database, you could try the truncate flag. However, if it causes an implicit flush for the transaction, you will be out of luck with that method on PHP 8.
I've solved this issue by using a custom purger, basically as described here: https://stackoverflow.com/questions/64570346/doctrine-fixtures-how-to-override-the-purger-class
There is such an tables architecture:
Execute
app:fixtures:load
with purge.When automatically deleting from network_switches_ports, I get an error:
FK from
hardware_ip_cameras
.If you delete in the correct order, then such an error would not have occurred.
Correct order of deleting from tables:
hardware_ip_cameras
,hardware_video_servers
,network_switches_ports
,hardware_network_switches
,hardware
.