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

@@ 1644-1665 (lines=22) @@
1641
     * @param int $contentId
1642
     * @param int|null $versionNo
1643
     */
1644
    public function deleteFields($contentId, $versionNo = null)
1645
    {
1646
        $query = $this->dbHandler->createDeleteQuery();
1647
        $query->deleteFrom('ezcontentobject_attribute')
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('version'),
1659
                    $query->bindValue($versionNo, null, \PDO::PARAM_INT)
1660
                )
1661
            );
1662
        }
1663
1664
        $query->prepare()->execute();
1665
    }
1666
1667
    /**
1668
     * Deletes all versions of $contentId.
@@ 1674-1695 (lines=22) @@
1671
     * @param int $contentId
1672
     * @param int|null $versionNo
1673
     */
1674
    public function deleteVersions($contentId, $versionNo = null)
1675
    {
1676
        $query = $this->dbHandler->createDeleteQuery();
1677
        $query->deleteFrom('ezcontentobject_version')
1678
            ->where(
1679
                $query->expr->eq(
1680
                    $this->dbHandler->quoteColumn('contentobject_id'),
1681
                    $query->bindValue($contentId, null, \PDO::PARAM_INT)
1682
                )
1683
            );
1684
1685
        if (isset($versionNo)) {
1686
            $query->where(
1687
                $query->expr->eq(
1688
                    $this->dbHandler->quoteColumn('version'),
1689
                    $query->bindValue($versionNo, null, \PDO::PARAM_INT)
1690
                )
1691
            );
1692
        }
1693
1694
        $query->prepare()->execute();
1695
    }
1696
1697
    /**
1698
     * Deletes all names of $contentId.
@@ 1704-1725 (lines=22) @@
1701
     * @param int $contentId
1702
     * @param int|null $versionNo
1703
     */
1704
    public function deleteNames($contentId, $versionNo = null)
1705
    {
1706
        $query = $this->dbHandler->createDeleteQuery();
1707
        $query->deleteFrom('ezcontentobject_name')
1708
            ->where(
1709
                $query->expr->eq(
1710
                    $this->dbHandler->quoteColumn('contentobject_id'),
1711
                    $query->bindValue($contentId, null, \PDO::PARAM_INT)
1712
                )
1713
            );
1714
1715
        if (isset($versionNo)) {
1716
            $query->where(
1717
                $query->expr->eq(
1718
                    $this->dbHandler->quoteColumn('content_version'),
1719
                    $query->bindValue($versionNo, null, \PDO::PARAM_INT)
1720
                )
1721
            );
1722
        }
1723
1724
        $query->prepare()->execute();
1725
    }
1726
1727
    /**
1728
     * Sets the name for Content $contentId in version $version to $name in $language.