[TYPO3-mvc] Problems with table mapping

Franz Koch typo3.RemoveForMessage at elements-net.de
Wed Apr 13 15:35:31 CEST 2011


Hey,

> I don`t think that extbase support this. I can patch the dataMapper.php a
> little bit to read from a plain table with another identifier as uid:
>
> 	/**
> 	 * 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) {
> 		
> 		if ($this->identityMap->hasIdentifier($row['uid'], $className)) {
> 			$object = $this->identityMap->getObjectByIdentifier($row['uid'],
> $className);
> 		} else {
> 			$object = $this->createEmptyObject($className);
> 			$this->identityMap->registerObject($object, $row['uid']);
> 			$this->thawProperties($object, $row);
> 			$object->_memorizeCleanState();
> 			$this->persistenceSession->registerReconstitutedObject($object);
> 		}
> 		return $object;
> 	}
>
>
> Is there any chance to pathc this function that i can give it the
> identifier column by typoscript for each table instead of a hardcoded uid
> field?

The IIRC columnMap already has a option to hold the name of the 
identifier field, but the UID unfortunately is currently somewhat 
hardcoded in many places. If you have the resources, we'd be happy if 
you could provide a patch. Also please check if there is already a 
ticket on forge, if not, please create one.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list