Bug #11893

The hash identifying a ValueObject isn't sufficient

Added by Jochen Rau almost 11 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Should have
Category:
Persistence
Start date:
2011-01-05
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

After executing the constructor of a Value Object a hash is generated and stored in FLOW3_Persistence_ValueObject_Hash to identify the Value Object (eg. to support getIdentifierByObject($object)). But the algorithm for generating the hash isn't sufficient for some cases.

Let's assume we have a Value Object \F3\MyExt\Domain\Model\Color with a property $colorNumber=42. This Value Object has the same hash as a Value Object \F3\MyExt\Domain\Model\Length with a property $value=42. The same problem occurs, if a Value Object stores other objects in an SplObjectStorage or uses PHP classes like DateTime.

IMHO the identity of a ValueObject is fully determined only by taking all property values (including SplObjectStorages) and the class into account. The test for FLOW3_Persistence_Entity_UUID could possibly be dropped as a Value Object by definition can't reference to Entities.

#1

Updated by Karsten Dambekalns over 10 years ago

  • Status changed from New to Accepted
  • Assignee set to Karsten Dambekalns
  • Target version set to 1.0 beta 1
#2

Updated by Mr. Hudson over 10 years ago

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

#3

Updated by Mr. Hudson over 10 years ago

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

#4

Updated by Karsten Dambekalns over 10 years ago

  • Status changed from Accepted to Under Review
#5

Updated by Mr. Hudson over 10 years ago

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

#6

Updated by Mr. Hudson over 10 years ago

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

#7

Updated by Karsten Dambekalns over 10 years ago

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

Also available in: Atom PDF