Feature #26861
closedExtbase - Abstract hierarchies over 2 levels are not recognized
0%
Description
Hello Typo3 Team,
I'm trying to write a plugin with extbase (using typo3 4.5 LTS), but there seems to be a lack of a feature for me within extbase. If you try to create class hierarchies like the one attached as PNG, you can't. Extbase only allows one abstract class in a hierarchy. The problem seems to be in the following function in the Tx_Extbase_Persistence_Mapper_DataMapper.php class:
public function getTargetType($className, array $row) {
00180 $dataMap = $this->getDataMap($className);
00181 $targetType = $className;
00182 if ($dataMap->getRecordTypeColumnName() !== NULL) {
00183 foreach ($dataMap->getSubclasses() as $subclassName) {
00184 $recordSubtype = $this->getDataMap($subclassName)->getRecordType();
00185 if ($row[$dataMap->getRecordTypeColumnName()] === $recordSubtype) {
00186 $targetType = $subclassName;
00187 break;
00188 }
00189 }
00190 }
00191 return $targetType;
00192 }
This function just iterates over one level of subclasses. ($dataMap->getSubclasses()) But if I define my subclasses as follows for the given structure:
config.tx_extbase.persistence.classes {
Tx_Myextension_Domain_Model_MediaItem {
subclasses {
Tx_Myextension_Domain_Model_MediaStream = Tx_Myextension_Domain_Model_MediaStream
Tx_Myextension_Domain_Model_MediaFile = Tx_Myextension_Domain_Model_MediaFile
}
}
Tx_Myextension_Domain_Model_MediaStream {
subclasses {
Tx_Myextension_Domain_Model_VideoStream = Tx_Myextension_Domain_Model_VideoStream
(...)
}
}
(...)
}
than I get an error that abstract classes cannot be instantiated, because the given function will return a Tx_Myextension_Domain_Model_MediaItem instead of Tx_Myextension_Domain_Model_VideoStream.
Best regards,
Zalán Somogyváry
Files