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

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