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

Closed
doctrinebot opened this Issue Apr 29, 2014 · 4 comments

4 participants

@doctrinebot

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:
[Doctrine\DBAL\DBALException]

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 Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
@DannyvdSluijs

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;
@Ocramius
Doctrine member

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

Closing as duplicate

@Ocramius Ocramius closed this Feb 4, 2016
@Ocramius Ocramius added the Duplicate label Feb 4, 2016
@Ocramius Ocramius assigned Ocramius and unassigned beberlei Feb 4, 2016
@Ocramius Ocramius removed the Bug label Feb 4, 2016
@DannyvdSluijs

Actually mine fails with Postgres 9.4.5 and not with MySQL.

@Ocramius
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