Closed jbenezech closed 8 years ago
@jbenezech What issue are you referencing ?
I think there are several pointing to the same problem: when there is a relationship between 2 entities as described below, when loading the fixtures and deleting the data, foreign key constraints are violated.
/**
* HarvestAnnouncement
* @ORM\Entity(repositoryClass="CRTP\HarvestBundle\Repository\HarvestAnnouncementRepository")
*/
class HarvestAnnouncement
/**
* @ORM\ManyToOne(targetEntity="CRTP\ProductBundle\Entity\SeedQuality")
* @ORM\JoinColumn(name="seed_quality_id", referencedColumnName="id", nullable=false, onDelete="restrict")
**/
private $seedQuality;
This one for example, proposes a fix for mysql: https://github.com/doctrine/data-fixtures/issues/113
I was about to open an issue for this exact same bug. It happens since the 1.2.0, and it is probably caused by this commit: https://github.com/doctrine/data-fixtures/pull/222
Currently I'm setting the version to 1.1.1 to avoid this bug.
@devantoine Can you check if you still have that issue with dev-master ? It should be fixed now. I f you confirm the fix then I will release 1.2.1
Thanks
@mikeSimonson Yes, it's fixed! Thanks!
I have seen some fix and workarounds to solve the foreign key constraint problem with mysql but am using postgres and haven't found any easy way to bypass this.
My current workaround kind of works but make the test so slow they become unusable.