Code Duplication    Length = 12-16 lines in 11 locations

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

@@ 130-145 (lines=16) @@
127
     *
128
     * @return string[][]
129
     */
130
    public function loadAllSectionData()
131
    {
132
        $query = $this->dbHandler->createSelectQuery();
133
        $query->select(
134
            $this->dbHandler->quoteColumn('id'),
135
            $this->dbHandler->quoteColumn('identifier'),
136
            $this->dbHandler->quoteColumn('name')
137
        )->from(
138
            $this->dbHandler->quoteTable('ezsection')
139
        );
140
141
        $statement = $query->prepare();
142
        $statement->execute();
143
144
        return $statement->fetchAll(\PDO::FETCH_ASSOC);
145
    }
146
147
    /**
148
     * Loads data for section with $identifier.
@@ 288-301 (lines=14) @@
285
     *
286
     * @param int $id
287
     */
288
    public function deleteSection($id)
289
    {
290
        $query = $this->dbHandler->createDeleteQuery();
291
        $query->deleteFrom(
292
            $this->dbHandler->quoteTable('ezsection')
293
        )->where(
294
            $query->expr->eq(
295
                $this->dbHandler->quoteColumn('id'),
296
                $query->bindValue($id, null, \PDO::PARAM_INT)
297
            )
298
        );
299
300
        $query->prepare()->execute();
301
    }
302
303
    /**
304
     * Inserts the assignment of $contentId to $sectionId.

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

@@ 214-227 (lines=14) @@
211
     *
212
     * @param int $id
213
     */
214
    public function deleteLanguage($id)
215
    {
216
        $query = $this->dbHandler->createDeleteQuery();
217
        $query->deleteFrom(
218
            $this->dbHandler->quoteTable('ezcontent_language')
219
        )->where(
220
            $query->expr->eq(
221
                $this->dbHandler->quoteColumn('id'),
222
                $query->bindValue($id, null, \PDO::PARAM_INT)
223
            )
224
        );
225
226
        $query->prepare()->execute();
227
    }
228
229
    /**
230
     * Check whether a language may be deleted.

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

@@ 363-376 (lines=14) @@
360
     *
361
     * @param int $stateId
362
     */
363
    public function deleteObjectStateLinks($stateId)
364
    {
365
        $query = $this->dbHandler->createDeleteQuery();
366
        $query->deleteFrom(
367
            $this->dbHandler->quoteTable('ezcobj_state_link')
368
        )->where(
369
            $query->expr->eq(
370
                $this->dbHandler->quoteColumn('contentobject_state_id'),
371
                $query->bindValue($stateId, null, \PDO::PARAM_INT)
372
            )
373
        );
374
375
        $query->prepare()->execute();
376
    }
377
378
    /**
379
     * Inserts a new object state group into database.
@@ 749-762 (lines=14) @@
746
     *
747
     * @param mixed $stateId
748
     */
749
    protected function deleteObjectStateTranslations($stateId)
750
    {
751
        $query = $this->dbHandler->createDeleteQuery();
752
        $query->deleteFrom(
753
            $this->dbHandler->quoteTable('ezcobj_state_language')
754
        )->where(
755
            $query->expr->eq(
756
                $this->dbHandler->quoteColumn('contentobject_state_id'),
757
                $query->bindValue($stateId, null, \PDO::PARAM_INT)
758
            )
759
        );
760
761
        $query->prepare()->execute();
762
    }
763
764
    /**
765
     * Inserts object state group translations into database.
@@ 806-819 (lines=14) @@
803
     *
804
     * @param mixed $groupId
805
     */
806
    protected function deleteObjectStateGroupTranslations($groupId)
807
    {
808
        $query = $this->dbHandler->createDeleteQuery();
809
        $query->deleteFrom(
810
            $this->dbHandler->quoteTable('ezcobj_state_group_language')
811
        )->where(
812
            $query->expr->eq(
813
                $this->dbHandler->quoteColumn('contentobject_state_group_id'),
814
                $query->bindValue($groupId, null, \PDO::PARAM_INT)
815
            )
816
        );
817
818
        $query->prepare()->execute();
819
    }
820
821
    /**
822
     * Generates language mask from provided language codes

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

@@ 258-269 (lines=12) @@
255
     *
256
     * @param int $groupId
257
     */
258
    public function deleteGroup($groupId)
259
    {
260
        $q = $this->dbHandler->createDeleteQuery();
261
        $q->deleteFrom($this->dbHandler->quoteTable('ezcontentclassgroup'))
262
            ->where(
263
                $q->expr->eq(
264
                    $this->dbHandler->quoteColumn('id'),
265
                    $q->bindValue($groupId, null, \PDO::PARAM_INT)
266
                )
267
            );
268
        $q->prepare()->execute();
269
    }
270
271
    /**
272
     * Inserts data into contentclass_name.

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

@@ 95-108 (lines=14) @@
92
     *
93
     * @param mixed $id
94
     */
95
    public function deleteUrlWildcard($id)
96
    {
97
        /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */
98
        $query = $this->dbHandler->createDeleteQuery();
99
        $query->deleteFrom(
100
            $this->dbHandler->quoteTable('ezurlwildcard')
101
        )->where(
102
            $query->expr->eq(
103
                $this->dbHandler->quoteColumn('id'),
104
                $query->bindValue($id, null, \PDO::PARAM_INT)
105
            )
106
        );
107
        $query->prepare()->execute();
108
    }
109
110
    /**
111
     * Loads an array with data about UrlWildcard with $id.

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

@@ 1484-1497 (lines=14) @@
1481
     *
1482
     * @param int $fieldId
1483
     */
1484
    public function deleteField($fieldId)
1485
    {
1486
        $query = $this->dbHandler->createDeleteQuery();
1487
        $query->deleteFrom(
1488
            $this->dbHandler->quoteTable('ezcontentobject_attribute')
1489
        )->where(
1490
            $query->expr->eq(
1491
                $this->dbHandler->quoteColumn('id'),
1492
                $query->bindValue($fieldId, null, \PDO::PARAM_INT)
1493
            )
1494
        );
1495
1496
        $query->prepare()->execute();
1497
    }
1498
1499
    /**
1500
     * Deletes all fields of $contentId in all versions.
@@ 1711-1723 (lines=13) @@
1708
     *
1709
     * @param int $contentId
1710
     */
1711
    public function deleteContent($contentId)
1712
    {
1713
        $query = $this->dbHandler->createDeleteQuery();
1714
        $query->deleteFrom('ezcontentobject')
1715
            ->where(
1716
                $query->expr->eq(
1717
                    $this->dbHandler->quoteColumn('id'),
1718
                    $query->bindValue($contentId, null, \PDO::PARAM_INT)
1719
                )
1720
            );
1721
1722
        $query->prepare()->execute();
1723
    }
1724
1725
    /**
1726
     * Loads relations from $contentId to published content, optionally only from $contentVersionNo.

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

@@ 961-976 (lines=16) @@
958
     * @param mixed $contentId
959
     * @param mixed $versionNo
960
     */
961
    public function updateLocationsContentVersionNo($contentId, $versionNo)
962
    {
963
        $query = $this->handler->createUpdateQuery();
964
        $query->update(
965
            $this->handler->quoteTable('ezcontentobject_tree')
966
        )->set(
967
            $this->handler->quoteColumn('contentobject_version'),
968
            $query->bindValue($versionNo, null, \PDO::PARAM_INT)
969
        )->where(
970
            $query->expr->eq(
971
                $this->handler->quoteColumn('contentobject_id'),
972
                $contentId
973
            )
974
        );
975
        $query->prepare()->execute();
976
    }
977
978
    /**
979
     * Searches for the main nodeId of $contentId in $versionId.