Code Duplication    Length = 30-31 lines in 2 locations

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

@@ 119-148 (lines=30) @@
116
     *
117
     * @return mixed Group ID
118
     */
119
    public function insertGroup(Group $group)
120
    {
121
        $q = $this->dbHandler->createInsertQuery();
122
        $q->insertInto(
123
            $this->dbHandler->quoteTable('ezcontentclassgroup')
124
        )->set(
125
            $this->dbHandler->quoteColumn('id'),
126
            $this->dbHandler->getAutoIncrementValue('ezcontentclassgroup', 'id')
127
        )->set(
128
            $this->dbHandler->quoteColumn('created'),
129
            $q->bindValue($group->created, null, \PDO::PARAM_INT)
130
        )->set(
131
            $this->dbHandler->quoteColumn('creator_id'),
132
            $q->bindValue($group->creatorId, null, \PDO::PARAM_INT)
133
        )->set(
134
            $this->dbHandler->quoteColumn('modified'),
135
            $q->bindValue($group->modified, null, \PDO::PARAM_INT)
136
        )->set(
137
            $this->dbHandler->quoteColumn('modifier_id'),
138
            $q->bindValue($group->modifierId, null, \PDO::PARAM_INT)
139
        )->set(
140
            $this->dbHandler->quoteColumn('name'),
141
            $q->bindValue($group->identifier)
142
        );
143
        $q->prepare()->execute();
144
145
        return $this->dbHandler->lastInsertId(
146
            $this->dbHandler->getSequenceName('ezcontentclassgroup', 'id')
147
        );
148
    }
149
150
    /**
151
     * Updates a group with data in $group.

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

@@ 1751-1781 (lines=31) @@
1748
     *
1749
     * @return int ID the inserted ID
1750
     */
1751
    public function insertRelation(RelationCreateStruct $createStruct)
1752
    {
1753
        $q = $this->dbHandler->createInsertQuery();
1754
        $q->insertInto(
1755
            $this->dbHandler->quoteTable('ezcontentobject_link')
1756
        )->set(
1757
            $this->dbHandler->quoteColumn('id'),
1758
            $this->dbHandler->getAutoIncrementValue('ezcontentobject_link', 'id')
1759
        )->set(
1760
            $this->dbHandler->quoteColumn('contentclassattribute_id'),
1761
            $q->bindValue((int)$createStruct->sourceFieldDefinitionId, null, \PDO::PARAM_INT)
1762
        )->set(
1763
            $this->dbHandler->quoteColumn('from_contentobject_id'),
1764
            $q->bindValue($createStruct->sourceContentId, null, \PDO::PARAM_INT)
1765
        )->set(
1766
            $this->dbHandler->quoteColumn('from_contentobject_version'),
1767
            $q->bindValue($createStruct->sourceContentVersionNo, null, \PDO::PARAM_INT)
1768
        )->set(
1769
            $this->dbHandler->quoteColumn('relation_type'),
1770
            $q->bindValue($createStruct->type, null, \PDO::PARAM_INT)
1771
        )->set(
1772
            $this->dbHandler->quoteColumn('to_contentobject_id'),
1773
            $q->bindValue($createStruct->destinationContentId, null, \PDO::PARAM_INT)
1774
        );
1775
1776
        $q->prepare()->execute();
1777
1778
        return $this->dbHandler->lastInsertId(
1779
            $this->dbHandler->getSequenceName('ezcontentobject_link', 'id')
1780
        );
1781
    }
1782
1783
    /**
1784
     * Deletes the relation with the given $relationId.