[BUGFIX] Make extbase subclasses work with numeric types 74/50374/2
authorSascha Egerer <sascha@sascha-egerer.de>
Tue, 25 Oct 2016 05:52:44 +0000 (07:52 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 25 Oct 2016 16:50:49 +0000 (18:50 +0200)
The extbase subclasses configuration does currently not work with a
numeric database field that identifies the type of a record. This is
due to a strict comparison that compares the stringish TypoScript
value against the numeric database value.

Both values are casted to string to make the comparision work.

Resolves: #78416
Releases: master, 7.6
Change-Id: Iea4cf41301892a6788facd3befe5533e263cc3f6
Reviewed-on: https://review.typo3.org/50374
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php

index fa7939c..1451720 100644 (file)
@@ -160,7 +160,7 @@ class DataMapper implements \TYPO3\CMS\Core\SingletonInterface
         if ($dataMap->getRecordTypeColumnName() !== null) {
             foreach ($dataMap->getSubclasses() as $subclassName) {
                 $recordSubtype = $this->getDataMap($subclassName)->getRecordType();
-                if ($row[$dataMap->getRecordTypeColumnName()] === $recordSubtype) {
+                if ((string)$row[$dataMap->getRecordTypeColumnName()] === (string)$recordSubtype) {
                     $targetType = $subclassName;
                     break;
                 }