[TYPO3-mvc] Problems with table mapping

Manfred Rutschmann manfred.rutschmann at revier.de
Fri Apr 15 13:32:16 CEST 2011


Am Fri, 15 Apr 2011 12:38:07 +0200 schrieb Peter Niederlag:

> $this->reflectionService->getClassSchema($className)->uuidPropertyName()
> 
> Greets and hth,
> Peter

Thanks Peter. I think you mean this one: 

$this->reflectionService->getClassSchema($className)->getUUIDPropertyName();

Thats the right way.

Now it reads if there is a property with the uuid set. Thats perfect. The
patch is very simple:

	/**
	 * Maps a single row on an object of the given class
	 *
	 * @param string $className The name of the target class
	 * @param array $row A single array with field_name => value pairs
	 * @return object An object of the given class
	 */
	protected function mapSingleRow($className, array $row) {
		// Check if we have a other identifier than uid
		$uuidPropertyName =
$this->reflectionService->getClassSchema($className)->getUUIDPropertyName(); 
		if(!$uuidPropertyName){
			$uuidPropertyName = 'uid';
		}

		if ($this->identityMap->hasIdentifier($row[$uuidPropertyName],
$className)) {
			$object =
$this->identityMap->getObjectByIdentifier($row[$uuidPropertyName],
$className);
		} else {
			$object = $this->createEmptyObject($className);
			$this->identityMap->registerObject($object, $row[$uuidPropertyName]);
			$this->thawProperties($object, $row);
			$object->_memorizeCleanState();
			$this->persistenceSession->registerReconstitutedObject($object);
		}
		return $object;
	}

I  make for this a ticket with patch on forge.

Regards Manfred


More information about the TYPO3-project-typo3v4mvc mailing list