Code Duplication    Length = 20-23 lines in 2 locations

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

@@ 1263-1285 (lines=23) @@
1260
     *
1261
     * @return int Number of affected rows.
1262
     */
1263
    public function deleteUrlAliasesWithoutParent()
1264
    {
1265
        $existingAliasesQuery = $this->getAllUrlAliasesQuery();
1266
1267
        $query = $this->connection->createQueryBuilder();
1268
        $query
1269
            ->delete($this->table)
1270
            ->where(
1271
                $query->expr()->neq(
1272
                    'parent',
1273
                    $query->createPositionalParameter(0, \PDO::PARAM_INT)
1274
                )
1275
            )
1276
            ->andWhere(
1277
                $query->expr()->notIn(
1278
                    'parent',
1279
                    $existingAliasesQuery
1280
                )
1281
            )
1282
        ;
1283
1284
        return $query->execute();
1285
    }
1286
1287
    /**
1288
     * Delete URL aliases which do not link to any existing URL alias node.
@@ 1292-1311 (lines=20) @@
1289
     *
1290
     * Note: Typically link column value is used to determine original alias for an archived entries.
1291
     */
1292
    public function deleteUrlAliasesWithBrokenLink()
1293
    {
1294
        $existingAliasesQuery = $this->getAllUrlAliasesQuery();
1295
1296
        $query = $this->connection->createQueryBuilder();
1297
        $query
1298
            ->delete($this->table)
1299
            ->where(
1300
                $query->expr()->neq('id', 'link')
1301
            )
1302
            ->andWhere(
1303
                $query->expr()->notIn(
1304
                    'link',
1305
                    $existingAliasesQuery
1306
                )
1307
            )
1308
        ;
1309
1310
        return $query->execute();
1311
    }
1312
1313
    /**
1314
     * Get subquery for IDs of all URL aliases.