Code Duplication    Length = 20-23 lines in 2 locations

eZ/Publish/Core/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php 2 locations

@@ 1335-1357 (lines=23) @@
1332
     *
1333
     * @return int Number of affected rows.
1334
     */
1335
    public function deleteUrlAliasesWithoutParent()
1336
    {
1337
        $existingAliasesQuery = $this->getAllUrlAliasesQuery();
1338
1339
        $query = $this->connection->createQueryBuilder();
1340
        $query
1341
            ->delete($this->table)
1342
            ->where(
1343
                $query->expr()->neq(
1344
                    'parent',
1345
                    $query->createPositionalParameter(0, \PDO::PARAM_INT)
1346
                )
1347
            )
1348
            ->andWhere(
1349
                $query->expr()->notIn(
1350
                    'parent',
1351
                    $existingAliasesQuery
1352
                )
1353
            )
1354
        ;
1355
1356
        return $query->execute();
1357
    }
1358
1359
    /**
1360
     * Delete URL aliases which do not link to any existing URL alias node.
@@ 1364-1383 (lines=20) @@
1361
     *
1362
     * Note: Typically link column value is used to determine original alias for an archived entries.
1363
     */
1364
    public function deleteUrlAliasesWithBrokenLink()
1365
    {
1366
        $existingAliasesQuery = $this->getAllUrlAliasesQuery();
1367
1368
        $query = $this->connection->createQueryBuilder();
1369
        $query
1370
            ->delete($this->table)
1371
            ->where(
1372
                $query->expr()->neq('id', 'link')
1373
            )
1374
            ->andWhere(
1375
                $query->expr()->notIn(
1376
                    'link',
1377
                    $existingAliasesQuery
1378
                )
1379
            )
1380
        ;
1381
1382
        return $query->execute();
1383
    }
1384
1385
    /**
1386
     * Attempt repairing data corruption for broken archived URL aliases for Location,