Some error about models. |
[eluser]rockstyle[/eluser]
I've got absolutely no idea what this means: Quote:Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[HY000]: General error: 1452 Cannot add or update a child row: a foreign key constraint fails (`ci_doctrine`.`bank`, CONSTRAINT `bank_category_id_category_id` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`))' in C:\xampplite\htdocs\ci_doctrine\system\application\plugins\doctrine\lib\Doctrine\Connection.php:1082 Stack trace: #0 C:\xampplite\htdocs\ci_doctrine\system\application\plugins\doctrine\lib\Doctrine\Connection\Statement.php(269): Doctrine_Connection->rethrowException(Object(PDOException), Object(Doctrine_Connection_Statement)) #1 C:\xampplite\htdocs\ci_doctrine\system\application\plugins\doctrine\lib\Doctrine\Connection.php(1042): Doctrine_Connection_Statement->execute(Array) #2 C:\xampplite\htdocs\ci_doctrine\system\application\plugins\doctrine\lib\Doctrine\Connection.php(687): Doctrine_Connection->exec('INSERT INTO ban...', Array) #3 C:\xampplite\htdocs\ci_doctrine\system\application\plugins\doctrine\lib\Doctrine\ in C:\xampplite\htdocs\ci_doctrine\system\application\plugins\doctrine\lib\Doctrine\Connection.php on line 1082 It happens when i'm trying to submit data from form. I think it's about models but i guess i made it right: Code: <?php Code: <?php
[eluser]danmontgomery[/eluser]
It's a MySQL error: Quote:General error: 1452 Cannot add or update a child row: a foreign key constraint fails (`ci_doctrine`.`bank`, CONSTRAINT `bank_category_id_category_id` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`)) I would guess that category.id isn't indexed or is indexed improperly
[eluser]rockstyle[/eluser]
Damn, everything should be working, my model is working, here is phpmyadmin view: http://img708.imageshack.us/img708/6849/relations.png Indexation should work fine. Banks are indexing from 11 but it should'nt be the problem since it's working. Banks indexing are because i deleted rows and added once again by yaml file and It shouldn't be the issue.
[eluser]danmontgomery[/eluser]
http://www.google.com/search?q=1452+Cann...aint+fails
[eluser]rockstyle[/eluser]
Quote:whenever we create a foreign key column in an already existing table, there should be no values in that table or in otherway to say table should be empty. Any simple trick how to do this? The need for emptying the table and insering values every time i update scares the hell out of me. Not to mention performance...
[eluser]theprodigy[/eluser]
Quote: #1 C:\xampplite\htdocs\ci_doctrine\system\application\plugins\doctrine\lib\Doctrine\Connection.php(1042): Doctrine_Connection_Statement->execute(Array)That's from the Stack Trace. It looks like you are trying to insert an array, and not a valid foreign key value. |
Welcome Guest, Not a member yet? Register Sign In |