Code Duplication    Length = 19-24 lines in 3 locations

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

@@ 75-94 (lines=20) @@
72
     * @param string $name
73
     * @param string $identifier
74
     */
75
    public function updateSection($id, $name, $identifier)
76
    {
77
        $query = $this->dbHandler->createUpdateQuery();
78
        $query->update(
79
            $this->dbHandler->quoteTable('ezsection')
80
        )->set(
81
            $this->dbHandler->quoteColumn('name'),
82
            $query->bindValue($name)
83
        )->set(
84
            $this->dbHandler->quoteColumn('identifier'),
85
            $query->bindValue($identifier)
86
        )->where(
87
            $query->expr->eq(
88
                $this->dbHandler->quoteColumn('id'),
89
                $query->bindValue($id, null, \PDO::PARAM_INT)
90
            )
91
        );
92
93
        $query->prepare()->execute();
94
    }
95
96
    /**
97
     * Loads data for section with $id.
@@ 183-206 (lines=24) @@
180
     *
181
     * @return int
182
     */
183
    public function countContentObjectsInSection($id)
184
    {
185
        $query = $this->dbHandler->createSelectQuery();
186
        $query->select(
187
            $query->alias(
188
                $query->expr->count(
189
                    $this->dbHandler->quoteColumn('id')
190
                ),
191
                'content_count'
192
            )
193
        )->from(
194
            $this->dbHandler->quoteTable('ezcontentobject')
195
        )->where(
196
            $query->expr->eq(
197
                $this->dbHandler->quoteColumn('section_id'),
198
                $query->bindValue($id, null, \PDO::PARAM_INT)
199
            )
200
        );
201
202
        $statement = $query->prepare();
203
        $statement->execute();
204
205
        return (int)$statement->fetchColumn();
206
    }
207
208
    /**
209
     * Counts the number of role policies using section with $id in their limitations.

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

@@ 1279-1297 (lines=19) @@
1276
     *
1277
     * @return int
1278
     */
1279
    public function getLastVersionNumber($contentId)
1280
    {
1281
        $query = $this->dbHandler->createSelectQuery();
1282
        $query->select(
1283
            $query->expr->max($this->dbHandler->quoteColumn('version'))
1284
        )->from(
1285
            $this->dbHandler->quoteTable('ezcontentobject_version')
1286
        )->where(
1287
            $query->expr->eq(
1288
                $this->dbHandler->quoteColumn('contentobject_id'),
1289
                $query->bindValue($contentId, null, \PDO::PARAM_INT)
1290
            )
1291
        );
1292
1293
        $statement = $query->prepare();
1294
        $statement->execute();
1295
1296
        return (int)$statement->fetchColumn();
1297
    }
1298
1299
    /**
1300
     * Returns all IDs for locations that refer to $contentId.