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

Dumping then Loading Fixtures with Foreign Keys #313

Closed
liamsorsby opened this issue Dec 3, 2014 · 2 comments
Closed

Dumping then Loading Fixtures with Foreign Keys #313

liamsorsby opened this issue Dec 3, 2014 · 2 comments

Comments

@liamsorsby
Copy link

When using propel:fixtures:dump to create the fixtures file.

I've then run propel:build --insert-sql to rebuild the sql and the model. Which successfully rebuilt the model and SQL.

I've then run propel:fixures:load which starts to load the file in however when it gets to foreign keys it throws the following error:

Unable to execute INSERT statement [INSERT INTO `ProductCategory` (`id`, `ProductID`, `CategoryID`) VALUES (:p0, :p1, :p2)] [wrapped: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`dbname`, `ProductCategory`, CONSTRAINT `ProductCategory_FK_1` FOREIGN KEY (`CategoryID`) REFERENCES `Category` (`id`) ON DELETE CASCADE)] 

The pastebin for the schema for the 3 tables: http://pastebin.com/n3cmVCXS
The pastebin for the Fixtures that were exported using propel:fixtures:dump: http://pastebin.com/F8evhHEv

@havvg
Copy link
Member

havvg commented Jan 24, 2016

I just tried it with an M:N relation, and it worked as expected. The pastebins have expired. If you still encounter the issue, let me know!

@havvg havvg closed this as completed Jan 24, 2016
@liamsorsby
Copy link
Author

@havvg,

The issue only occurred with fixtures when objects are used.

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

2 participants