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
Updated by Alexander Opitz over 10 years ago
- Status changed from New to Needs Feedback
Hi,
as this issue is very old. Does the problem still exists within newer versions of TYPO3 CMS (4.5.35 or 6.2.4)?
Updated by Alexander Opitz almost 10 years ago
- Status changed from Needs Feedback to Closed
- Assignee deleted (
Jochen Rau)
No feedback within the last 90 days => closing this issue.
If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.