Feature #105188 ยป patch-extbase-datamapper-uidcolumnname.diff
web/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php 2024-10-03 11:16:25.000000000 +0200 | ||
---|---|---|
use TYPO3\CMS\Extbase\Object\Exception\CannotReconstituteObjectException;
|
||
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
|
||
use TYPO3\CMS\Extbase\Persistence;
|
||
use TYPO3\CMS\Extbase\Persistence\ClassesConfiguration;
|
||
use TYPO3\CMS\Extbase\Persistence\Generic\Exception;
|
||
use TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnexpectedTypeException;
|
||
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
|
||
... | ... | |
// @deprecated since v11, will be removed in v12
|
||
protected ObjectManagerInterface $objectManager;
|
||
protected EventDispatcherInterface $eventDispatcher;
|
||
/**
|
||
* @var ClassesConfiguration
|
||
*/
|
||
private $classesConfiguration;
|
||
/**
|
||
* @var QueryInterface|null
|
||
... | ... | |
DataMapFactory $dataMapFactory,
|
||
QueryFactoryInterface $queryFactory,
|
||
ObjectManagerInterface $objectManager,
|
||
EventDispatcherInterface $eventDispatcher
|
||
EventDispatcherInterface $eventDispatcher,
|
||
ClassesConfiguration $classesConfiguration,
|
||
) {
|
||
$this->reflectionService = $reflectionService;
|
||
$this->qomFactory = $qomFactory;
|
||
... | ... | |
// @deprecated since v11, will be removed in v12.
|
||
$this->objectManager = $objectManager;
|
||
$this->eventDispatcher = $eventDispatcher;
|
||
$this->classesConfiguration = $classesConfiguration;
|
||
}
|
||
/**
|
||
... | ... | |
*/
|
||
protected function mapSingleRow($className, array $row)
|
||
{
|
||
if ($this->persistenceSession->hasIdentifier($row['uid'], $className)) {
|
||
$object = $this->persistenceSession->getObjectByIdentifier($row['uid'], $className);
|
||
$classSettings = $this->classesConfiguration->getConfigurationFor($className);
|
||
$uidColumnName = 'uid';
|
||
if ($classSettings && array_key_exists($uidColumnName, $classSettings['properties'])) {
|
||
$uidColumnName = $classSettings['properties'][$uidColumnName]['fieldName'];
|
||
}
|
||
if ($this->persistenceSession->hasIdentifier($row[$uidColumnName], $className)) {
|
||
$object = $this->persistenceSession->getObjectByIdentifier($row[$uidColumnName], $className);
|
||
} else {
|
||
$object = $this->createEmptyObject($className);
|
||
$this->persistenceSession->registerObject($object, $row['uid']);
|
||
$this->persistenceSession->registerObject($object, $row[$uidColumnName]);
|
||
$this->thawProperties($object, $row);
|
||
$event = new AfterObjectThawedEvent($object, $row);
|
||
$this->eventDispatcher->dispatch($event);
|