Code Duplication    Length = 15-15 lines in 8 locations

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

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

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

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

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

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

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

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

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

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

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

@@ 150-164 (lines=15) @@
147
     * @throws RecordNotPersistedException
148
     * @return UserEntity
149
     */
150
    public function remove(UserEntity $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
            ['id' => $entity->id]
159
        );
160
161
        $entity->id = null;
162
163
        return $entity;
164
    }
165
166
    /**
167
     * Converts database array to entity array.

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

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

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

@@ 132-146 (lines=15) @@
129
     * @throws RecordNotPersistedException
130
     * @return PageEntity
131
     */
132
    public function remove(PageEntity $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
            ['id' => $entity->id]
141
        );
142
143
        $entity->id = null;
144
145
        return $entity;
146
    }
147
148
    /**
149
     * Maps the given entity to the database array.