Code Duplication    Length = 21-29 lines in 3 locations

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

@@ 102-122 (lines=21) @@
99
     *
100
     * @return string[][]
101
     */
102
    public function loadSectionData($id)
103
    {
104
        $query = $this->dbHandler->createSelectQuery();
105
        $query->select(
106
            $this->dbHandler->quoteColumn('id'),
107
            $this->dbHandler->quoteColumn('identifier'),
108
            $this->dbHandler->quoteColumn('name')
109
        )->from(
110
            $this->dbHandler->quoteTable('ezsection')
111
        )->where(
112
            $query->expr->eq(
113
                $this->dbHandler->quoteColumn('id'),
114
                $query->bindValue($id, null, \PDO::PARAM_INT)
115
            )
116
        );
117
118
        $statement = $query->prepare();
119
        $statement->execute();
120
121
        return $statement->fetchAll(\PDO::FETCH_ASSOC);
122
    }
123
124
    /**
125
     * Loads data for all sections.
@@ 153-173 (lines=21) @@
150
     *
151
     * @return string[][]
152
     */
153
    public function loadSectionDataByIdentifier($identifier)
154
    {
155
        $query = $this->dbHandler->createSelectQuery();
156
        $query->select(
157
            $this->dbHandler->quoteColumn('id'),
158
            $this->dbHandler->quoteColumn('identifier'),
159
            $this->dbHandler->quoteColumn('name')
160
        )->from(
161
            $this->dbHandler->quoteTable('ezsection')
162
        )->where(
163
            $query->expr->eq(
164
                $this->dbHandler->quoteColumn('identifier'),
165
                $query->bindValue($identifier, null, \PDO::PARAM_STR)
166
            )
167
        );
168
169
        $statement = $query->prepare();
170
        $statement->execute();
171
172
        return $statement->fetchAll(\PDO::FETCH_ASSOC);
173
    }
174
175
    /**
176
     * Counts the number of content objects assigned to section with $id.

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

@@ 660-688 (lines=29) @@
657
     *
658
     * @return mixed
659
     */
660
    public function getNextId()
661
    {
662
        $sequence = $this->dbHandler->getSequenceName('ezurlalias_ml_incr', 'id');
663
        /** @var $query \eZ\Publish\Core\Persistence\Database\InsertQuery */
664
        $query = $this->dbHandler->createInsertQuery();
665
        $query->insertInto(
666
            $this->dbHandler->quoteTable('ezurlalias_ml_incr')
667
        );
668
        // ezcDatabase does not abstract the "auto increment id"
669
        // INSERT INTO ezurlalias_ml_incr VALUES(DEFAULT) is not an option due
670
        // to this mysql bug: http://bugs.mysql.com/bug.php?id=42270
671
        // as a result we are forced to check which database is currently used
672
        // to generate the correct SQL query
673
        // see https://jira.ez.no/browse/EZP-20652
674
        if ($this->dbHandler->useSequences()) {
675
            $query->set(
676
                $this->dbHandler->quoteColumn('id'),
677
                "nextval('{$sequence}')"
678
            );
679
        } else {
680
            $query->set(
681
                $this->dbHandler->quoteColumn('id'),
682
                $query->bindValue(null, null, \PDO::PARAM_NULL)
683
            );
684
        }
685
        $query->prepare()->execute();
686
687
        return $this->dbHandler->lastInsertId($sequence);
688
    }
689
690
    /**
691
     * Loads single row data matched by composite primary key.