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/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.

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

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

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

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

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

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