Bug #34448

Integrity constraint violation on FLOW3 resource tables

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

Status:
Resolved
Priority:
Should have
Category:
Persistence
Target version:
-
Start date:
2012-03-01
Due date:
% Done:

100%

Estimated time:
PHP Version:
5.3
Has patch:
No
Complexity:

Description

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()
#1

Updated by Karsten Dambekalns over 9 years ago

  • Category changed from - Error Handler Report - to Persistence
  • Status changed from New to Accepted
  • Assignee set to Karsten Dambekalns
#2

Updated by Gerrit Code Review over 9 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/10137

#3

Updated by Gerrit Code Review over 9 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/10137

#4

Updated by Gerrit Code Review about 9 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/10137

#5

Updated by Gerrit Code Review about 9 years ago

Patch set 1 for branch FLOW3-1.1 has been pushed to the review server.
It is available at http://review.typo3.org/11800

#6

Updated by Ferdinand Kuhl about 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF