Bug #29244

cloning models don't reset persistence identifier

Added by Torsten no-lastname-given almost 4 years ago. Updated almost 4 years ago.

Status:Resolved Start date:2011-08-25
Priority:Should have Due date:
Assigned To:- % Done:

100%

Category:Persistence
Target version:-
PHP Version: Complexity:
Has patch: Affected Flow version:

Description

Adding cloned models to repository throws "SQLSTATE23000: Integrity constraint violation: 1062 Duplicate entry" Exception.

This solves the issue:

public function __clone() {
    $this->FLOW3_Persistence_Identifier = \TYPO3\FLOW3\Utility\Algorithms::generateUUID();
}

Associated revisions

Revision 295a024e
Added by Christian Müller almost 4 years ago

[BUGFIX] Cloning an entity should result in a new Uuid

With this change cloning an entity object results in the clone
having a new UUID as FLOW3_Persistence_Identifier so persisting
the clone should work without problems. Note that this isn't the
case for value objects.

Change-Id: Ic1856a192dd9a0f6f189934480b44320d0222b70
Resolves: #29244

History

#1 Updated by Karsten Dambekalns almost 4 years ago

That code should be part of the PersistenceMagicAspect and affect entities only.

#2 Updated by Mr. Hudson almost 4 years ago

  • Status changed from New to Under Review

Patch set 1 of change Ic1856a192dd9a0f6f189934480b44320d0222b70 has been pushed to the review server.
It is available at http://review.typo3.org/4596

#3 Updated by Mr. Hudson almost 4 years ago

Patch set 2 of change Ic1856a192dd9a0f6f189934480b44320d0222b70 has been pushed to the review server.
It is available at http://review.typo3.org/4596

#4 Updated by Mr. Hudson almost 4 years ago

Patch set 3 of change Ic1856a192dd9a0f6f189934480b44320d0222b70 has been pushed to the review server.
It is available at http://review.typo3.org/4596

#5 Updated by Mr. Hudson almost 4 years ago

Patch set 4 of change Ic1856a192dd9a0f6f189934480b44320d0222b70 has been pushed to the review server.
It is available at http://review.typo3.org/4596

#6 Updated by Mr. Hudson almost 4 years ago

Patch set 5 of change Ic1856a192dd9a0f6f189934480b44320d0222b70 has been pushed to the review server.
It is available at http://review.typo3.org/4596

#7 Updated by Mr. Hudson almost 4 years ago

Patch set 6 of change Ic1856a192dd9a0f6f189934480b44320d0222b70 has been pushed to the review server.
It is available at http://review.typo3.org/4596

#8 Updated by Christian Müller almost 4 years ago

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

Also available in: Atom PDF