I am getting the following error when i try and insert something into my database:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails
(`database_name`.`catalog_category_entity_varchar`, CONSTRAINT `FK_CAT_CTGR_ENTT_VCHR_ENTT_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_category_entity` (`entity_i)'
Am i right in thinking this means:
there is an entity_i
in catalog_category_entity
that is not found in
entity_id
in catalog_category_entity_varchar
Is there an SQL query i can do on the database that can find what is causing this?
The database is Magentos and this error comes up simply when i create a category programmatically:
$category = Mage::getModel('catalog/category');
$category->setName($design);
$category->setPath($path);
$category->save();