Code Duplication    Length = 21-22 lines in 4 locations

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.

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

@@ 1584-1605 (lines=22) @@
1581
     * @param int $contentId
1582
     * @param int|null $versionNo
1583
     */
1584
    public function deleteFields($contentId, $versionNo = null)
1585
    {
1586
        $query = $this->dbHandler->createDeleteQuery();
1587
        $query->deleteFrom('ezcontentobject_attribute')
1588
            ->where(
1589
                $query->expr->eq(
1590
                    $this->dbHandler->quoteColumn('contentobject_id'),
1591
                    $query->bindValue($contentId, null, \PDO::PARAM_INT)
1592
                )
1593
            );
1594
1595
        if (isset($versionNo)) {
1596
            $query->where(
1597
                $query->expr->eq(
1598
                    $this->dbHandler->quoteColumn('version'),
1599
                    $query->bindValue($versionNo, null, \PDO::PARAM_INT)
1600
                )
1601
            );
1602
        }
1603
1604
        $query->prepare()->execute();
1605
    }
1606
1607
    /**
1608
     * Deletes all versions of $contentId.
@@ 1614-1635 (lines=22) @@
1611
     * @param int $contentId
1612
     * @param int|null $versionNo
1613
     */
1614
    public function deleteVersions($contentId, $versionNo = null)
1615
    {
1616
        $query = $this->dbHandler->createDeleteQuery();
1617
        $query->deleteFrom('ezcontentobject_version')
1618
            ->where(
1619
                $query->expr->eq(
1620
                    $this->dbHandler->quoteColumn('contentobject_id'),
1621
                    $query->bindValue($contentId, null, \PDO::PARAM_INT)
1622
                )
1623
            );
1624
1625
        if (isset($versionNo)) {
1626
            $query->where(
1627
                $query->expr->eq(
1628
                    $this->dbHandler->quoteColumn('version'),
1629
                    $query->bindValue($versionNo, null, \PDO::PARAM_INT)
1630
                )
1631
            );
1632
        }
1633
1634
        $query->prepare()->execute();
1635
    }
1636
1637
    /**
1638
     * Deletes all names of $contentId.
@@ 1644-1665 (lines=22) @@
1641
     * @param int $contentId
1642
     * @param int|null $versionNo
1643
     */
1644
    public function deleteNames($contentId, $versionNo = null)
1645
    {
1646
        $query = $this->dbHandler->createDeleteQuery();
1647
        $query->deleteFrom('ezcontentobject_name')
1648
            ->where(
1649
                $query->expr->eq(
1650
                    $this->dbHandler->quoteColumn('contentobject_id'),
1651
                    $query->bindValue($contentId, null, \PDO::PARAM_INT)
1652
                )
1653
            );
1654
1655
        if (isset($versionNo)) {
1656
            $query->where(
1657
                $query->expr->eq(
1658
                    $this->dbHandler->quoteColumn('content_version'),
1659
                    $query->bindValue($versionNo, null, \PDO::PARAM_INT)
1660
                )
1661
            );
1662
        }
1663
1664
        $query->prepare()->execute();
1665
    }
1666
1667
    /**
1668
     * Sets the name for Content $contentId in version $version to $name in $language.