Code Duplication    Length = 21-22 lines in 4 locations

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

@@ 1519-1540 (lines=22) @@
1516
     * @param int $contentId
1517
     * @param int|null $versionNo
1518
     */
1519
    public function deleteFields($contentId, $versionNo = null)
1520
    {
1521
        $query = $this->dbHandler->createDeleteQuery();
1522
        $query->deleteFrom('ezcontentobject_attribute')
1523
            ->where(
1524
                $query->expr->eq(
1525
                    $this->dbHandler->quoteColumn('contentobject_id'),
1526
                    $query->bindValue($contentId, null, \PDO::PARAM_INT)
1527
                )
1528
            );
1529
1530
        if (isset($versionNo)) {
1531
            $query->where(
1532
                $query->expr->eq(
1533
                    $this->dbHandler->quoteColumn('version'),
1534
                    $query->bindValue($versionNo, null, \PDO::PARAM_INT)
1535
                )
1536
            );
1537
        }
1538
1539
        $query->prepare()->execute();
1540
    }
1541
1542
    /**
1543
     * Deletes all versions of $contentId.
@@ 1549-1570 (lines=22) @@
1546
     * @param int $contentId
1547
     * @param int|null $versionNo
1548
     */
1549
    public function deleteVersions($contentId, $versionNo = null)
1550
    {
1551
        $query = $this->dbHandler->createDeleteQuery();
1552
        $query->deleteFrom('ezcontentobject_version')
1553
            ->where(
1554
                $query->expr->eq(
1555
                    $this->dbHandler->quoteColumn('contentobject_id'),
1556
                    $query->bindValue($contentId, null, \PDO::PARAM_INT)
1557
                )
1558
            );
1559
1560
        if (isset($versionNo)) {
1561
            $query->where(
1562
                $query->expr->eq(
1563
                    $this->dbHandler->quoteColumn('version'),
1564
                    $query->bindValue($versionNo, null, \PDO::PARAM_INT)
1565
                )
1566
            );
1567
        }
1568
1569
        $query->prepare()->execute();
1570
    }
1571
1572
    /**
1573
     * Deletes all names of $contentId.
@@ 1579-1600 (lines=22) @@
1576
     * @param int $contentId
1577
     * @param int|null $versionNo
1578
     */
1579
    public function deleteNames($contentId, $versionNo = null)
1580
    {
1581
        $query = $this->dbHandler->createDeleteQuery();
1582
        $query->deleteFrom('ezcontentobject_name')
1583
            ->where(
1584
                $query->expr->eq(
1585
                    $this->dbHandler->quoteColumn('contentobject_id'),
1586
                    $query->bindValue($contentId, null, \PDO::PARAM_INT)
1587
                )
1588
            );
1589
1590
        if (isset($versionNo)) {
1591
            $query->where(
1592
                $query->expr->eq(
1593
                    $this->dbHandler->quoteColumn('content_version'),
1594
                    $query->bindValue($versionNo, null, \PDO::PARAM_INT)
1595
                )
1596
            );
1597
        }
1598
1599
        $query->prepare()->execute();
1600
    }
1601
1602
    /**
1603
     * Sets the name for Content $contentId in version $version to $name in $language.

eZ/Publish/Core/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php 1 location

@@ 867-887 (lines=21) @@
864
     * @param int $contentId
865
     * @param int|null $versionNo
866
     */
867
    public function deleteNodeAssignment($contentId, $versionNo = null)
868
    {
869
        $query = $this->handler->createDeleteQuery();
870
        $query->deleteFrom(
871
            'eznode_assignment'
872
        )->where(
873
            $query->expr->eq(
874
                $this->handler->quoteColumn('contentobject_id'),
875
                $query->bindValue($contentId, null, \PDO::PARAM_INT)
876
            )
877
        );
878
        if (isset($versionNo)) {
879
            $query->where(
880
                $query->expr->eq(
881
                    $this->handler->quoteColumn('contentobject_version'),
882
                    $query->bindValue($versionNo, null, \PDO::PARAM_INT)
883
                )
884
            );
885
        }
886
        $query->prepare()->execute();
887
    }
888
889
    /**
890
     * Update node assignment table.