Skip to content


DDC-3105: Doctrine Console Error (ORMPurger) #3881

doctrinebot opened this Issue · 4 comments

4 participants


Jira issue originally created by user inhack20:

In symfony2 the command doctrine:fixtures:load Fails One-To-Many, Self-referencing using Doctrine\Common\DataFixtures\Purger\ORMPurger in example:

class DescriptionArea
* @ORM\OneToMany(targetEntity="DescriptionArea", mappedBy="parent")
protected $descriptionAreas;

 * @ORM\ManyToOne(targetEntity="DescriptionArea", inversedBy="descriptionAreas")
protected $parent;
Throw error:

An exception occurred while executing 'DELETE FROM prefix_DescriptionArea':

SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (sigtec*dev.prefix*DescriptionArea,

CONSTRAINT FK*7265873E727ACA70 FOREIGN KEY (parent_id) REFERENCES prefix*DescriptionArea (id))

Before running the query should delete the index when the table has self-reference.

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added the Bug label

I'm having the same for but not or a self referencing relation.

 * @ORM\OneToMany(targetEntity="Person", mappedBy="organisationalUnit")
private $persons;

 * @ORM\ManyToOne(targetEntity="OrganisationalUnit", inversedBy="persons")
 * @ORM\JoinColumn(name="organisational_unit_id",  nullable=false)
private $organisationUnit;
Doctrine member

To be tracked in doctrine/data-fixtures#127 instead.

Closing as duplicate

@Ocramius Ocramius closed this
@Ocramius Ocramius added the Duplicate label
@beberlei beberlei was unassigned by Ocramius
@Ocramius Ocramius self-assigned this
@Ocramius Ocramius removed the Bug label

Actually mine fails with Postgres 9.4.5 and not with MySQL.

Doctrine member

@DannyvdSluijs consider looking into the doctrine/data-fixtures issue tracker first anyway :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.