Bug #3478

Reconstitution of object respects class schema - but persistence doesn't

Added by Robert Lemke about 6 years ago. Updated about 4 years ago.

Status:Resolved Start date:2009-05-27
Priority:Must have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:FLOW3 Persistence
Target version:-

Description

/**
 * @entity
 * @scope prototype
 */
class Release {

    /**
     * @var string
     */
    protected $versionNumber;
}

$versionNumber is declared as string. If by some mistake $versionNumber contains an array of strings, the CR will persist the array (string[]) without problems (ignoring the class schema) but while reconstituting the object the CR complains with this exception:

#1181084521: getValue() cannot be called on multi-valued properties. (More information)

F3\PHPCR\ValueFormatException thrown in file
/Users/Shared/Sites/dev/flow3/dist/Packages/Global/TYPO3CR/Classes/Property.php in line 166.

25 F3\TYPO3CR\Property::getValue()

/Users/Shared/Sites/dev/flow3/dist/Packages/Global/TYPO3CR/Classes/FLOW3/Persistence/DataMapper.php:
00316:   */
00317:  protected function getNativeValue(\F3\PHPCR\PropertyInterface $property) {
00318:   $value = $property->getValue();
00319:   switch ($property->getType()) {
00320:    case \F3\PHPCR\PropertyType::BOOLEAN:

24 F3\TYPO3CR\FLOW3\Persistence\DataMapper::getNativeValue(F3\TYPO3CR\Property)

/Users/Shared/Sites/dev/flow3/dist/Packages/Global/TYPO3CR/Classes/FLOW3/Persistence/DataMapper.php:
00170:      if ($node->hasProperty('flow3:' . $propertyName)) {
00171:       $property = $node->getProperty('flow3:' . $propertyName);
00172:       $propertyValue = $this->getNativeValue($property);
00173:      }
00174:     break;

23 F3\TYPO3CR\FLOW3\Persistence\DataMapper::thawProperties(F3\Releazr\Domain\Model\Release_AOPProxy_Development, F3\TYPO3CR\Node, F3\FLOW3\Persistence\ClassSchema)

/Users/Shared/Sites/dev/flow3/dist/Packages/Global/TYPO3CR/Classes/FLOW3/Persistence/DataMapper.php:
00140: 
00141:    $this->objectBuilder->reinjectDependencies($object, $objectConfiguration);
00142:    $this->thawProperties($object, $node, $classSchema);
00143:    $object->FLOW3_Persistence_memorizeCleanState();
00144:    $this->persistenceManager->getSession()->registerReconstitutedObject($object);

Associated revisions

Revision 5818c78d
Added by Karsten Dambekalns about 6 years ago

[FIX] TYPO3CR (FLOW3 Persistence): When persisting objects the actual type of property values is now checked against the expected type, fixes #3478
[TASK] TYPO3CR (FLOW3 Persistence): marked methods in backend as @internal

History

#1 Updated by Karsten Dambekalns about 6 years ago

  • Status changed from New to Accepted
  • Target version set to 197

Should such properties (not having the expected type) be ignored or cause an exception to be thrown?

#2 Updated by Karsten Dambekalns about 6 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r2586.

#3 Updated by Robert Lemke about 4 years ago

  • Target version deleted (197)

Also available in: Atom PDF