Code Duplication    Length = 15-15 lines in 8 locations

htdocs/src/Oc/Country/CountryRepository.php 1 location

@@ 132-146 (lines=15) @@
129
     *
130
     * @throws RecordNotPersistedException
131
     */
132
    public function remove(CountryEntity $entity)
133
    {
134
        if ($entity->isNew()) {
135
            throw new RecordNotPersistedException('The entity does not exist.');
136
        }
137
138
        $this->connection->delete(
139
            self::TABLE,
140
            ['short' => $entity->short]
141
        );
142
143
        $entity->short = null;
144
145
        return $entity;
146
    }
147
148
    /**
149
     * Maps the given entity to the database array.

htdocs/src/Oc/FieldNotes/Persistence/FieldNoteRepository.php 1 location

@@ 244-258 (lines=15) @@
241
     *
242
     * @throws RecordNotPersistedException
243
     */
244
    public function remove(FieldNoteEntity $entity)
245
    {
246
        if ($entity->isNew()) {
247
            throw new RecordNotPersistedException('The entity does not exist.');
248
        }
249
250
        $this->connection->delete(
251
            self::TABLE,
252
            ['id' => $entity->id]
253
        );
254
255
        $entity->id = null;
256
257
        return $entity;
258
    }
259
260
    /**
261
     * Maps the given entity to the database array.

htdocs/src/Oc/GeoCache/Persistence/GeoCache/GeoCacheRepository.php 1 location

@@ 239-253 (lines=15) @@
236
     *
237
     * @throws RecordNotPersistedException
238
     */
239
    public function remove(GeoCacheEntity $entity)
240
    {
241
        if ($entity->isNew()) {
242
            throw new RecordNotPersistedException('The entity does not exist.');
243
        }
244
245
        $this->connection->delete(
246
            self::TABLE,
247
            ['cache_id' => $entity->cacheId]
248
        );
249
250
        $entity->cacheId = null;
251
252
        return $entity;
253
    }
254
255
    /**
256
     * Maps the given entity to the database array.

htdocs/src/Oc/GeoCache/Persistence/GeoCacheLog/GeoCacheLogRepository.php 1 location

@@ 235-249 (lines=15) @@
232
     *
233
     * @throws RecordNotPersistedException
234
     */
235
    public function remove(GeoCacheLogEntity $entity)
236
    {
237
        if ($entity->isNew()) {
238
            throw new RecordNotPersistedException('The entity does not exist.');
239
        }
240
241
        $this->connection->delete(
242
            self::TABLE,
243
            ['id' => $entity->id]
244
        );
245
246
        $entity->id = null;
247
248
        return $entity;
249
    }
250
251
    /**
252
     * Maps the given entity to the database array.

htdocs/src/Oc/Language/LanguageRepository.php 1 location

@@ 150-164 (lines=15) @@
147
     *
148
     * @throws RecordNotPersistedException
149
     */
150
    public function remove(LanguageEntity $entity)
151
    {
152
        if ($entity->isNew()) {
153
            throw new RecordNotPersistedException('The entity does not exist.');
154
        }
155
156
        $this->connection->delete(
157
            self::TABLE,
158
            ['short' => $entity->short]
159
        );
160
161
        $entity->short = null;
162
163
        return $entity;
164
    }
165
166
    /**
167
     * Converts database array to entity array.

htdocs/src/Oc/Page/BlockRepository.php 1 location

@@ 142-156 (lines=15) @@
139
     *
140
     * @throws RecordNotPersistedException
141
     */
142
    public function remove(BlockEntity $entity)
143
    {
144
        if ($entity->isNew()) {
145
            throw new RecordNotPersistedException('The entity does not exist.');
146
        }
147
148
        $this->connection->delete(
149
            self::TABLE,
150
            ['id' => $entity->id]
151
        );
152
153
        $entity->id = null;
154
155
        return $entity;
156
    }
157
158
    /**
159
     * Maps the given entity to the database array.

htdocs/src/Oc/Page/PageRepository.php 1 location

@@ 138-152 (lines=15) @@
135
     *
136
     * @throws RecordNotPersistedException
137
     */
138
    public function remove(PageEntity $entity)
139
    {
140
        if ($entity->isNew()) {
141
            throw new RecordNotPersistedException('The entity does not exist.');
142
        }
143
144
        $this->connection->delete(
145
            self::TABLE,
146
            ['id' => $entity->id]
147
        );
148
149
        $entity->id = null;
150
151
        return $entity;
152
    }
153
154
    /**
155
     * Maps the given entity to the database array.

htdocs/src/Oc/User/UserRepository.php 1 location

@@ 157-171 (lines=15) @@
154
     *
155
     * @throws RecordNotPersistedException
156
     */
157
    public function remove(UserEntity $entity)
158
    {
159
        if ($entity->isNew()) {
160
            throw new RecordNotPersistedException('The entity does not exist.');
161
        }
162
163
        $this->connection->delete(
164
            self::TABLE,
165
            ['id' => $entity->id]
166
        );
167
168
        $entity->id = null;
169
170
        return $entity;
171
    }
172
173
    /**
174
     * Converts database array to entity array.