Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

doctrinebot opened this issue Apr 29, 2014 · 4 comments
Assignees

Comments

@doctrinebot
Copy link

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.

@DannyvdSluijs
Copy link

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
Copy link
Member

Ocramius commented Feb 4, 2016

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

Closing as duplicate

@Ocramius Ocramius closed this as completed Feb 4, 2016
@Ocramius Ocramius assigned Ocramius and unassigned beberlei Feb 4, 2016
@Ocramius Ocramius removed the Bug label Feb 4, 2016
@DannyvdSluijs
Copy link

Actually mine fails with Postgres 9.4.5 and not with MySQL.

@Ocramius
Copy link
Member

Ocramius commented Feb 4, 2016

@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
Projects
None yet
Development

No branches or pull requests

4 participants