Code Duplication    Length = 14-18 lines in 10 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

@@ 194-207 (lines=14) @@
191
     *
192
     * @param int $id
193
     */
194
    public function deleteLanguage($id)
195
    {
196
        $query = $this->dbHandler->createDeleteQuery();
197
        $query->deleteFrom(
198
            $this->dbHandler->quoteTable('ezcontent_language')
199
        )->where(
200
            $query->expr->eq(
201
                $this->dbHandler->quoteColumn('id'),
202
                $query->bindValue($id, null, \PDO::PARAM_INT)
203
            )
204
        );
205
206
        $query->prepare()->execute();
207
    }
208
209
    /**
210
     * Check whether a language may be deleted.

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

@@ 372-385 (lines=14) @@
369
     *
370
     * @param int $stateId
371
     */
372
    public function deleteObjectStateLinks($stateId)
373
    {
374
        $query = $this->dbHandler->createDeleteQuery();
375
        $query->deleteFrom(
376
            $this->dbHandler->quoteTable('ezcobj_state_link')
377
        )->where(
378
            $query->expr->eq(
379
                $this->dbHandler->quoteColumn('contentobject_state_id'),
380
                $query->bindValue($stateId, null, \PDO::PARAM_INT)
381
            )
382
        );
383
384
        $query->prepare()->execute();
385
    }
386
387
    /**
388
     * Inserts a new object state group into database.
@@ 766-779 (lines=14) @@
763
     *
764
     * @param mixed $stateId
765
     */
766
    protected function deleteObjectStateTranslations($stateId)
767
    {
768
        $query = $this->dbHandler->createDeleteQuery();
769
        $query->deleteFrom(
770
            $this->dbHandler->quoteTable('ezcobj_state_language')
771
        )->where(
772
            $query->expr->eq(
773
                $this->dbHandler->quoteColumn('contentobject_state_id'),
774
                $query->bindValue($stateId, null, \PDO::PARAM_INT)
775
            )
776
        );
777
778
        $query->prepare()->execute();
779
    }
780
781
    /**
782
     * Inserts object state group translations into database.
@@ 823-836 (lines=14) @@
820
     *
821
     * @param mixed $groupId
822
     */
823
    protected function deleteObjectStateGroupTranslations($groupId)
824
    {
825
        $query = $this->dbHandler->createDeleteQuery();
826
        $query->deleteFrom(
827
            $this->dbHandler->quoteTable('ezcobj_state_group_language')
828
        )->where(
829
            $query->expr->eq(
830
                $this->dbHandler->quoteColumn('contentobject_state_group_id'),
831
                $query->bindValue($groupId, null, \PDO::PARAM_INT)
832
            )
833
        );
834
835
        $query->prepare()->execute();
836
    }
837
}
838

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

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

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

@@ 468-485 (lines=18) @@
465
     * @param string $pathString
466
     * @param bool $isHidden
467
     */
468
    private function setNodeHiddenStatus(string $pathString, bool $isHidden): void
469
    {
470
        $query = $this->handler->createUpdateQuery();
471
        $query
472
            ->update($this->handler->quoteTable('ezcontentobject_tree'))
473
            ->set(
474
                $this->handler->quoteColumn('is_hidden'),
475
                $query->bindValue((int) $isHidden)
476
            )
477
            ->where(
478
                $query->expr->eq(
479
                    $this->handler->quoteColumn('path_string'),
480
                    $query->bindValue($pathString)
481
                )
482
            );
483
484
        $query->prepare()->execute();
485
    }
486
487
    /**
488
     * Sets a location to be unhidden, and self + children to visible unless a parent is hiding the tree.
@@ 1002-1017 (lines=16) @@
999
     * @param mixed $contentId
1000
     * @param mixed $versionNo
1001
     */
1002
    public function updateLocationsContentVersionNo($contentId, $versionNo)
1003
    {
1004
        $query = $this->handler->createUpdateQuery();
1005
        $query->update(
1006
            $this->handler->quoteTable('ezcontentobject_tree')
1007
        )->set(
1008
            $this->handler->quoteColumn('contentobject_version'),
1009
            $query->bindValue($versionNo, null, \PDO::PARAM_INT)
1010
        )->where(
1011
            $query->expr->eq(
1012
                $this->handler->quoteColumn('contentobject_id'),
1013
                $contentId
1014
            )
1015
        );
1016
        $query->prepare()->execute();
1017
    }
1018
1019
    /**
1020
     * Searches for the main nodeId of $contentId in $versionId.

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

@@ 274-289 (lines=16) @@
271
     *
272
     * @param string $hash
273
     */
274
    public function expireUserToken($hash)
275
    {
276
        $query = $this->handler->createUpdateQuery();
277
        $query
278
            ->update($this->handler->quoteTable('ezuser_accountkey'))
279
            ->set(
280
                $this->handler->quoteColumn('time'),
281
                $query->bindValue(0)
282
            )->where(
283
                $query->expr->eq(
284
                    $this->handler->quoteColumn('hash_key'),
285
                    $query->bindValue($hash, null, \PDO::PARAM_STR)
286
                )
287
            );
288
        $query->prepare()->execute();
289
    }
290
291
    /**
292
     * Assigns role to user with given limitation.