Code Duplication    Length = 18-22 lines in 5 locations

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

@@ 827-844 (lines=18) @@
824
     * @param int $typeId
825
     * @param int $typeStatus
826
     */
827
    protected function deleteTypeNameData($typeId, $typeStatus)
828
    {
829
        $query = $this->dbHandler->createDeleteQuery();
830
        $query->deleteFrom('ezcontentclass_name')
831
            ->where(
832
                $query->expr->lAnd(
833
                    $query->expr->eq(
834
                        $this->dbHandler->quoteColumn('contentclass_id'),
835
                        $query->bindValue($typeId, null, \PDO::PARAM_INT)
836
                    ),
837
                    $query->expr->eq(
838
                        $this->dbHandler->quoteColumn('contentclass_version'),
839
                        $query->bindValue($typeStatus, null, \PDO::PARAM_INT)
840
                    )
841
                )
842
            );
843
        $query->prepare()->execute();
844
    }
845
846
    /**
847
     * Update a type with $updateStruct.

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

@@ 1506-1527 (lines=22) @@
1503
     * @param int $contentId
1504
     * @param int|null $versionNo
1505
     */
1506
    public function deleteFields($contentId, $versionNo = null)
1507
    {
1508
        $query = $this->dbHandler->createDeleteQuery();
1509
        $query->deleteFrom('ezcontentobject_attribute')
1510
            ->where(
1511
                $query->expr->eq(
1512
                    $this->dbHandler->quoteColumn('contentobject_id'),
1513
                    $query->bindValue($contentId, null, \PDO::PARAM_INT)
1514
                )
1515
            );
1516
1517
        if (isset($versionNo)) {
1518
            $query->where(
1519
                $query->expr->eq(
1520
                    $this->dbHandler->quoteColumn('version'),
1521
                    $query->bindValue($versionNo, null, \PDO::PARAM_INT)
1522
                )
1523
            );
1524
        }
1525
1526
        $query->prepare()->execute();
1527
    }
1528
1529
    /**
1530
     * Deletes all versions of $contentId.
@@ 1536-1557 (lines=22) @@
1533
     * @param int $contentId
1534
     * @param int|null $versionNo
1535
     */
1536
    public function deleteVersions($contentId, $versionNo = null)
1537
    {
1538
        $query = $this->dbHandler->createDeleteQuery();
1539
        $query->deleteFrom('ezcontentobject_version')
1540
            ->where(
1541
                $query->expr->eq(
1542
                    $this->dbHandler->quoteColumn('contentobject_id'),
1543
                    $query->bindValue($contentId, null, \PDO::PARAM_INT)
1544
                )
1545
            );
1546
1547
        if (isset($versionNo)) {
1548
            $query->where(
1549
                $query->expr->eq(
1550
                    $this->dbHandler->quoteColumn('version'),
1551
                    $query->bindValue($versionNo, null, \PDO::PARAM_INT)
1552
                )
1553
            );
1554
        }
1555
1556
        $query->prepare()->execute();
1557
    }
1558
1559
    /**
1560
     * Deletes all names of $contentId.
@@ 1566-1587 (lines=22) @@
1563
     * @param int $contentId
1564
     * @param int|null $versionNo
1565
     */
1566
    public function deleteNames($contentId, $versionNo = null)
1567
    {
1568
        $query = $this->dbHandler->createDeleteQuery();
1569
        $query->deleteFrom('ezcontentobject_name')
1570
            ->where(
1571
                $query->expr->eq(
1572
                    $this->dbHandler->quoteColumn('contentobject_id'),
1573
                    $query->bindValue($contentId, null, \PDO::PARAM_INT)
1574
                )
1575
            );
1576
1577
        if (isset($versionNo)) {
1578
            $query->where(
1579
                $query->expr->eq(
1580
                    $this->dbHandler->quoteColumn('content_version'),
1581
                    $query->bindValue($versionNo, null, \PDO::PARAM_INT)
1582
                )
1583
            );
1584
        }
1585
1586
        $query->prepare()->execute();
1587
    }
1588
1589
    /**
1590
     * 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

@@ 826-846 (lines=21) @@
823
     * @param int $contentId
824
     * @param int|null $versionNo
825
     */
826
    public function deleteNodeAssignment($contentId, $versionNo = null)
827
    {
828
        $query = $this->handler->createDeleteQuery();
829
        $query->deleteFrom(
830
            'eznode_assignment'
831
        )->where(
832
            $query->expr->eq(
833
                $this->handler->quoteColumn('contentobject_id'),
834
                $query->bindValue($contentId, null, \PDO::PARAM_INT)
835
            )
836
        );
837
        if (isset($versionNo)) {
838
            $query->where(
839
                $query->expr->eq(
840
                    $this->handler->quoteColumn('contentobject_version'),
841
                    $query->bindValue($versionNo, null, \PDO::PARAM_INT)
842
                )
843
            );
844
        }
845
        $query->prepare()->execute();
846
    }
847
848
    /**
849
     * Update node assignment table.