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

@@ 1858-1888 (lines=31) @@
1855
     *
1856
     * @return int ID the inserted ID
1857
     */
1858
    public function insertRelation(RelationCreateStruct $createStruct)
1859
    {
1860
        $q = $this->dbHandler->createInsertQuery();
1861
        $q->insertInto(
1862
            $this->dbHandler->quoteTable('ezcontentobject_link')
1863
        )->set(
1864
            $this->dbHandler->quoteColumn('id'),
1865
            $this->dbHandler->getAutoIncrementValue('ezcontentobject_link', 'id')
1866
        )->set(
1867
            $this->dbHandler->quoteColumn('contentclassattribute_id'),
1868
            $q->bindValue((int)$createStruct->sourceFieldDefinitionId, null, \PDO::PARAM_INT)
1869
        )->set(
1870
            $this->dbHandler->quoteColumn('from_contentobject_id'),
1871
            $q->bindValue($createStruct->sourceContentId, null, \PDO::PARAM_INT)
1872
        )->set(
1873
            $this->dbHandler->quoteColumn('from_contentobject_version'),
1874
            $q->bindValue($createStruct->sourceContentVersionNo, null, \PDO::PARAM_INT)
1875
        )->set(
1876
            $this->dbHandler->quoteColumn('relation_type'),
1877
            $q->bindValue($createStruct->type, null, \PDO::PARAM_INT)
1878
        )->set(
1879
            $this->dbHandler->quoteColumn('to_contentobject_id'),
1880
            $q->bindValue($createStruct->destinationContentId, null, \PDO::PARAM_INT)
1881
        );
1882
1883
        $q->prepare()->execute();
1884
1885
        return $this->dbHandler->lastInsertId(
1886
            $this->dbHandler->getSequenceName('ezcontentobject_link', 'id')
1887
        );
1888
    }
1889
1890
    /**
1891
     * Deletes the relation with the given $relationId.