Project

General

Profile

Actions

Feature #26861

closed

Extbase - Abstract hierarchies over 2 levels are not recognized

Added by Zalán Somogyváry over 13 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Content Rendering
Target version:
-
Start date:
2011-05-17
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.3
Tags:
Complexity:
Sprint Focus:

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

AbstractThrough2Levels.png (44.4 KB) AbstractThrough2Levels.png Zalán Somogyváry, 2011-05-17 15:50
Actions

Also available in: Atom PDF