Bug #51236

Task #55953: Repair and streamline ValueObject support

ValueObject Identity generation broken in some cases

Added by Philipp Maier about 8 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Must have
Assignee:
Category:
-
Target version:
-
Start date:
2013-08-21
Due date:
% Done:

100%

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

Description

Consider this example ValueObject with two attributes.

<?php
namespace Vendor\Package\Domain\Model;

use TYPO3\Flow\Annotations as Flow;

/**
 * @Flow\ValueObject
 */
class Test {

  /**
   * @var string
   */
  protected $prop1;

  /**
   * @var string
   */
  protected $prop2;

  /**
   * @param string $prop1
   * @param string $prop2
   */
  public function __construct($prop1, $prop2) {
    $this->prop1 = $prop1;
    $this->prop2 = $prop2;
  }

  // ...
}

$test1 = new Test('Name', '');
$test2 = new Test('', 'Name');

$test1 and $test2 will have the same Identity generated by the PersistenceMagicAspect::generateValueHash because the names of the attributes are not included in the hash.
Fixing this will probably break some stuff.

--
Please also regard https://review.typo3.org/#/c/11368/4 in that matter

Also available in: Atom PDF