Code Duplication    Length = 23-25 lines in 2 locations

Script/Repository/QuickInsertRepository.php 1 location

@@ 188-212 (lines=25) @@
185
        return $whereSql;
186
    }
187
188
    public static function findNextId($tableName, &$out = null)
189
    {
190
        $sql = "
191
            SELECT
192
                AUTO_INCREMENT
193
            FROM
194
                information_schema.tables
195
            WHERE
196
                table_name = '".$tableName."'
197
            AND
198
                table_schema = DATABASE()
199
        ";
200
        if ($out) {
201
            $out = $sql;
202
        }
203
        $sth = self::$connection->prepare($sql);
204
        $sth->execute();
205
        $result = $sth->fetch();
206
207
        if (isset($result['AUTO_INCREMENT'])) {
208
            return (int)$result['AUTO_INCREMENT'];
209
        }
210
211
        return 1;
212
    }
213
214
    public static function get($object, $one = false, $where = [], $noFkCheck = true, $fields = [], $manager = null, $extra = [], &$out = null)
215
    {

Translatable/Repository/TranslatableRepository.php 1 location

@@ 207-229 (lines=23) @@
204
        return $result;
205
    }
206
207
    public static function findNextId($object)
208
    {
209
        $data = Quick::extractExt($object, self::$em);
210
        $sql = "
211
            SELECT
212
                AUTO_INCREMENT
213
            FROM
214
                information_schema.tables
215
            WHERE
216
                table_name = '".$data['table']."'
217
            AND
218
                table_schema = DATABASE()
219
        ";
220
        $sth = self::$connection->prepare($sql);
221
        $sth->execute();
222
        $result = $sth->fetch();
223
224
        if (isset($result['AUTO_INCREMENT'])) {
225
            return (int)$result['AUTO_INCREMENT'];
226
        }
227
228
        return 1;
229
    }
230
}
231