Code Duplication    Length = 13-13 lines in 2 locations

eZ/Bundle/EzPublishLegacySearchEngineBundle/Command/CreateIndexCommand.php 1 location

@@ 124-136 (lines=13) @@
121
        $i = 0;
122
        do {
123
            $contentObjects = [];
124
            for ($k = 0; $k <= $bulkCount; ++$k) {
125
                if (!$row = $stmt->fetch(PDO::FETCH_ASSOC)) {
126
                    break;
127
                }
128
                try {
129
                    $contentObjects[] = $this->persistenceHandler->contentHandler()->load(
130
                        $row['id'],
131
                        $row['current_version']
132
                    );
133
                } catch (NotFoundException $e) {
134
                    $this->logWarning($output, $progress, "Could not load current version of Content with id ${row['id']}, so skipped for indexing. Full exception: " . $e->getMessage());
135
                }
136
            }
137
138
            $this->searchHandler->bulkIndex(
139
                $contentObjects,

eZ/Publish/Core/Search/Elasticsearch/Content/Indexer.php 1 location

@@ 56-68 (lines=13) @@
53
        $i = 0;
54
        do {
55
            $contentObjects = [];
56
            for ($k = 0; $k <= $iterationCount; ++$k) {
57
                if (!$row = $stmt->fetch(PDO::FETCH_ASSOC)) {
58
                    break;
59
                }
60
                try {
61
                    $contentObjects[] = $this->persistenceHandler->contentHandler()->load(
62
                        $row['id'],
63
                        $row['current_version']
64
                    );
65
                } catch (NotFoundException $e) {
66
                    $this->logWarning($progress, "Could not load current version of Content with id ${row['id']}, so skipped for indexing. Full exception: " . $e->getMessage());
67
                }
68
            }
69
            foreach ($contentObjects as $contentObject) {
70
                try {
71
                    $this->searchHandler->indexContent($contentObject);