Code Duplication    Length = 30-33 lines in 2 locations

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

@@ 334-366 (lines=33) @@
331
     * @param mixed $parentId
332
     * @param string $textMD5
333
     */
334
    protected function historize($parentId, $textMD5, $newId)
335
    {
336
        /** @var $query \eZ\Publish\Core\Persistence\Database\UpdateQuery */
337
        $query = $this->dbHandler->createUpdateQuery();
338
        $query->update(
339
            $this->dbHandler->quoteTable('ezurlalias_ml')
340
        )->set(
341
            $this->dbHandler->quoteColumn('is_original'),
342
            $query->bindValue(0, null, \PDO::PARAM_INT)
343
        )->set(
344
            $this->dbHandler->quoteColumn('link'),
345
            $query->bindValue($newId, null, \PDO::PARAM_INT)
346
        )->set(
347
            $this->dbHandler->quoteColumn('id'),
348
            $query->bindValue(
349
                $this->getNextId(),
350
                null,
351
                \PDO::PARAM_INT
352
            )
353
        )->where(
354
            $query->expr->lAnd(
355
                $query->expr->eq(
356
                    $this->dbHandler->quoteColumn('parent'),
357
                    $query->bindValue($parentId, null, \PDO::PARAM_INT)
358
                ),
359
                $query->expr->eq(
360
                    $this->dbHandler->quoteColumn('text_md5'),
361
                    $query->bindValue($textMD5, null, \PDO::PARAM_STR)
362
                )
363
            )
364
        );
365
        $query->prepare()->execute();
366
    }
367
368
    /**
369
     * Updates single row data matched by composite primary key.
@@ 414-443 (lines=30) @@
411
     * @param mixed $id
412
     * @param mixed $link
413
     */
414
    public function historizeId($id, $link)
415
    {
416
        /** @var $query \eZ\Publish\Core\Persistence\Database\UpdateQuery */
417
        $query = $this->dbHandler->createUpdateQuery();
418
        $query->update(
419
            $this->dbHandler->quoteTable('ezurlalias_ml')
420
        )->set(
421
            $this->dbHandler->quoteColumn('is_original'),
422
            $query->bindValue(0, null, \PDO::PARAM_INT)
423
        )->set(
424
            $this->dbHandler->quoteColumn('link'),
425
            $query->bindValue($link, null, \PDO::PARAM_INT)
426
        )->where(
427
            $query->expr->lAnd(
428
                $query->expr->eq(
429
                    $this->dbHandler->quoteColumn('is_alias'),
430
                    $query->bindValue(0, null, \PDO::PARAM_INT)
431
                ),
432
                $query->expr->eq(
433
                    $this->dbHandler->quoteColumn('action_type'),
434
                    $query->bindValue('eznode', null, \PDO::PARAM_STR)
435
                ),
436
                $query->expr->eq(
437
                    $this->dbHandler->quoteColumn('link'),
438
                    $query->bindValue($id, null, \PDO::PARAM_INT)
439
                )
440
            )
441
        );
442
        $query->prepare()->execute();
443
    }
444
445
    /**
446
     * Updates parent id of autogenerated entries.