Bug #34448

Integrity constraint violation on FLOW3 resource tables

Added by Jonas over 9 years ago. Updated over 9 years ago.

Should have
Target version:
Start date:
Due date:
% Done:


Estimated time:
PHP Version:
Has patch:


I have an own model/class/controller, called "award" with a property mapped to the standard FLOW3 resource table.

 * The image
 * @var \TYPO3\FLOW3\Resource\Resource
 * @ORM\ManyToOne(targetEntity="\TYPO3\FLOW3\Resource\Resource")
protected $image;

This works fine, the images get uploaded and the resource and resourcepointer tables are correctly filled. Then I created two of my award models and uploaded the same image for every one. Still all works fine, the resourcepointer table stays with only one entry and the resource table filled up with the same 'resourcepointer'-field for every record.

The error occurs when I try to delete my award-object. It seems FLOW3 tries to delete the only record of the resourcepointer table even though there still exist references from my other award-object.
This naturally fails and the following error pops up:

SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`praemien`.`typo3_flow3_resource_resource`, CONSTRAINT `typo3_flow3_resource_resource_ibfk_1` FOREIGN KEY (`resourcepointer`) REFERENCES `typo3_flow3_resource_resourcepointer` (`hash`)
13 PDOStatement::execute(array)
12 Doctrine\DBAL\Connection::executeUpdate("DELETE FROM typo3_flow3_resource_resourcepointer WHERE hash = ?", array)
11 Doctrine\DBAL\Connection::delete("typo3_flow3_resource_resourcepointer", array)
10 Doctrine\ORM\Persisters\BasicEntityPersister::delete(TYPO3\FLOW3\Persistence\Doctrine\Proxies\TYPO3FLOW3ResourceResourcePointerProxy)
9 Doctrine\ORM\UnitOfWork::executeDeletions(TYPO3\FLOW3\Persistence\Doctrine\Mapping\ClassMetadata)
8 Doctrine\ORM\UnitOfWork::commit()
7 Doctrine\ORM\EntityManager::flush()
6 TYPO3\FLOW3\Persistence\Doctrine\PersistenceManager_Original::persistAll("TYPO3\FLOW3\Core\Bootstrap::finishedRuntimeRun")
5 call_user_func_array(array, array)
4 TYPO3\FLOW3\SignalSlot\Dispatcher::dispatch("TYPO3\FLOW3\Core\Bootstrap", "finishedRuntimeRun", array)
3 TYPO3\FLOW3\Core\Bootstrap::emitFinishedRuntimeRun()
2 TYPO3\FLOW3\Core\Bootstrap::handleWebRequest()
1 TYPO3\FLOW3\Core\Bootstrap::run()

Also available in: Atom PDF