Code Duplication    Length = 26-28 lines in 2 locations

typo3/sysext/core/Classes/Database/QueryGenerator.php 1 location

@@ 851-878 (lines=28) @@
848
                    }
849
                }
850
            }
851
            if (stristr($fieldSetup['allowed'], ',')) {
852
                $from_table_Arr = explode(',', $fieldSetup['allowed']);
853
                $useTablePrefix = 1;
854
                if (!$fieldSetup['prepend_tname']) {
855
                    $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
856
                    $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
857
                    $statement = $queryBuilder->select($fieldName)
858
                        ->from($table)
859
                        ->execute();
860
                    while ($row = $statement->fetch()) {
861
                        if (stristr($row[$fieldName], ',')) {
862
                            $checkContent = explode(',', $row[$fieldName]);
863
                            foreach ($checkContent as $singleValue) {
864
                                if (!stristr($singleValue, '_')) {
865
                                    $dontPrefixFirstTable = 1;
866
                                }
867
                            }
868
                        } else {
869
                            $singleValue = $row[$fieldName];
870
                            if ($singleValue !== '' && !stristr($singleValue, '_')) {
871
                                $dontPrefixFirstTable = 1;
872
                            }
873
                        }
874
                    }
875
                }
876
            } else {
877
                $from_table_Arr[0] = $fieldSetup['allowed'];
878
            }
879
            if ($fieldSetup['prepend_tname']) {
880
                $useTablePrefix = 1;
881
            }

typo3/sysext/core/Classes/Database/QueryView.php 1 location

@@ 994-1019 (lines=26) @@
991
                    }
992
                }
993
            }
994
            if (stristr($fieldSetup['allowed'], ',')) {
995
                $from_table_Arr = explode(',', $fieldSetup['allowed']);
996
                $useTablePrefix = 1;
997
                if (!$fieldSetup['prepend_tname']) {
998
                    $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
999
                    $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
1000
                    $statement = $queryBuilder->select($fieldName)->from($table)->execute();
1001
                    while ($row = $statement->fetch()) {
1002
                        if (stristr($row[$fieldName], ',')) {
1003
                            $checkContent = explode(',', $row[$fieldName]);
1004
                            foreach ($checkContent as $singleValue) {
1005
                                if (!stristr($singleValue, '_')) {
1006
                                    $dontPrefixFirstTable = 1;
1007
                                }
1008
                            }
1009
                        } else {
1010
                            $singleValue = $row[$fieldName];
1011
                            if ($singleValue !== '' && !stristr($singleValue, '_')) {
1012
                                $dontPrefixFirstTable = 1;
1013
                            }
1014
                        }
1015
                    }
1016
                }
1017
            } else {
1018
                $from_table_Arr[0] = $fieldSetup['allowed'];
1019
            }
1020
            if ($fieldSetup['prepend_tname']) {
1021
                $useTablePrefix = 1;
1022
            }