Code Duplication    Length = 30-31 lines in 2 locations

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

@@ 131-160 (lines=30) @@
128
     *
129
     * @return mixed Group ID
130
     */
131
    public function insertGroup(Group $group)
132
    {
133
        $q = $this->dbHandler->createInsertQuery();
134
        $q->insertInto(
135
            $this->dbHandler->quoteTable('ezcontentclassgroup')
136
        )->set(
137
            $this->dbHandler->quoteColumn('id'),
138
            $this->dbHandler->getAutoIncrementValue('ezcontentclassgroup', 'id')
139
        )->set(
140
            $this->dbHandler->quoteColumn('created'),
141
            $q->bindValue($group->created, null, \PDO::PARAM_INT)
142
        )->set(
143
            $this->dbHandler->quoteColumn('creator_id'),
144
            $q->bindValue($group->creatorId, null, \PDO::PARAM_INT)
145
        )->set(
146
            $this->dbHandler->quoteColumn('modified'),
147
            $q->bindValue($group->modified, null, \PDO::PARAM_INT)
148
        )->set(
149
            $this->dbHandler->quoteColumn('modifier_id'),
150
            $q->bindValue($group->modifierId, null, \PDO::PARAM_INT)
151
        )->set(
152
            $this->dbHandler->quoteColumn('name'),
153
            $q->bindValue($group->identifier)
154
        );
155
        $q->prepare()->execute();
156
157
        return $this->dbHandler->lastInsertId(
158
            $this->dbHandler->getSequenceName('ezcontentclassgroup', 'id')
159
        );
160
    }
161
162
    /**
163
     * Updates a group with data in $group.

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

@@ 1880-1910 (lines=31) @@
1877
     *
1878
     * @return int ID the inserted ID
1879
     */
1880
    public function insertRelation(RelationCreateStruct $createStruct)
1881
    {
1882
        $q = $this->dbHandler->createInsertQuery();
1883
        $q->insertInto(
1884
            $this->dbHandler->quoteTable('ezcontentobject_link')
1885
        )->set(
1886
            $this->dbHandler->quoteColumn('id'),
1887
            $this->dbHandler->getAutoIncrementValue('ezcontentobject_link', 'id')
1888
        )->set(
1889
            $this->dbHandler->quoteColumn('contentclassattribute_id'),
1890
            $q->bindValue((int)$createStruct->sourceFieldDefinitionId, null, \PDO::PARAM_INT)
1891
        )->set(
1892
            $this->dbHandler->quoteColumn('from_contentobject_id'),
1893
            $q->bindValue($createStruct->sourceContentId, null, \PDO::PARAM_INT)
1894
        )->set(
1895
            $this->dbHandler->quoteColumn('from_contentobject_version'),
1896
            $q->bindValue($createStruct->sourceContentVersionNo, null, \PDO::PARAM_INT)
1897
        )->set(
1898
            $this->dbHandler->quoteColumn('relation_type'),
1899
            $q->bindValue($createStruct->type, null, \PDO::PARAM_INT)
1900
        )->set(
1901
            $this->dbHandler->quoteColumn('to_contentobject_id'),
1902
            $q->bindValue($createStruct->destinationContentId, null, \PDO::PARAM_INT)
1903
        );
1904
1905
        $q->prepare()->execute();
1906
1907
        return $this->dbHandler->lastInsertId(
1908
            $this->dbHandler->getSequenceName('ezcontentobject_link', 'id')
1909
        );
1910
    }
1911
1912
    /**
1913
     * Deletes the relation with the given $relationId.