I’m about to install the yii-user extension as a part of my website, but run into problems. If I import the module, the application gives me the following error message:
CDbCommand failed to execute the SQL statement: SQLSTATE: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails.
Have you experiences the same problem yourself, and/or do you know what I can do to solve it?
The problem is that you are trying add a duplicated value on an "unique" field
add to your model’s rules
Im not really sure where to find duplicated value.
The problem has probably something to do with me, because I’m new to Yii and php programming as a whole.
Based on the yii blog demo, I have expanded that with yii-user. If I follow along the installation manual,
doing the import, add module array, as well as components user array, and then login with the newly created yii-user module, thereby tries to create a post, it gives me the error:
CDbCommand failed to execute the SQL statement: SQLSTATE: Integrity constraint violation:
1452 Cannot add or update a child row: a foreign key constraint fails
If I import:
I can still create a post with the blog-demo. If I import user.models and components after, it also fails with the same error message.
So what I want, is to replace the blog-demo authentication with your yii-user extension.
What am I missing?
NOTE: moved to proper section (Extensions instead of General Discussion for Yii 1.1.x)
I miss read the first time
Its not about duplication,
The problem is that you are filling a foreigner key with a value that does not match in the foreigner table