Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[TASK] Move iconFactory initialization out of loop
Resolves: #91459
Relates: #91302
Releases: master
Change-Id: Ic4af3247d7557a6c12a8d538e85795c507eab69a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64561
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
  • Loading branch information
o-ba authored and ervaude committed May 22, 2020
1 parent 4bb0919 commit e3ad2bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Expand Up @@ -520,6 +520,7 @@ protected function addItemsFromForeignTable(array $result, $fieldName, array $it
}

$fileRepository = GeneralUtility::makeInstance(FileRepository::class);
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);

while ($foreignRow = $queryResult->fetch()) {
BackendUtility::workspaceOL($foreignTable, $foreignRow);
Expand All @@ -546,7 +547,6 @@ protected function addItemsFromForeignTable(array $result, $fieldName, array $it
}
} else {
// Else, determine icon based on record type, or a generic fallback
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$icon = $iconFactory->mapRecordTypeToIconIdentifier($foreignTable, $foreignRow);
}
// Add the item
Expand Down
Expand Up @@ -121,6 +121,7 @@ public function addDataAddsTreeConfigurationForSelectTreeElement()

$iconFactoryProphecy = $this->prophesize(IconFactory::class);
GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());
GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());

$fileRepositoryProphecy = $this->prophesize(FileRepository::class);
$fileRepositoryProphecy->findByRelation(Argument::cetera())->shouldNotBeCalled();
Expand Down Expand Up @@ -191,6 +192,7 @@ public function addDataHandsPageTsConfigSettingsOverToTableConfigurationTree()

$iconFactoryProphecy = $this->prophesize(IconFactory::class);
GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());
GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());

$fileRepositoryProphecy = $this->prophesize(FileRepository::class);
$fileRepositoryProphecy->findByRelation(Argument::cetera())->shouldNotBeCalled();
Expand Down

0 comments on commit e3ad2bd

Please sign in to comment.