Code Duplication    Length = 20-23 lines in 2 locations

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

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