Skip to content

Commit

Permalink
Delete data when basic data streams are deleted. Fixes #488
Browse files Browse the repository at this point in the history
  • Loading branch information
mstenta committed Jan 19, 2022
1 parent d161d22 commit 7925b5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- [Data is not deleted when a data stream entity is deleted #488](https://github.com/farmOS/farmOS/issues/488)
- [Data does not immediately appear when posting to data streams #484](https://github.com/farmOS/farmOS/issues/484)
- [Route "entity.data_stream.collection" does not exist. #486](https://github.com/farmOS/farmOS/issues/486)
- Fix Quick Form help text so that it works with new multi-route approach.
Expand Down
7 changes: 7 additions & 0 deletions modules/core/data_stream/data_stream.module
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,11 @@ function data_stream_data_stream_delete(DataStreamInterface $data_stream) {
\Drupal::database()->delete('asset__data_stream')
->condition('data_stream_target_id', $data_stream->id())
->execute();

// If this is a "basic" data stream, delete data associated with it.
if ($data_stream->bundle() == 'basic' && !empty($data_stream->id())) {
\Drupal::database()->delete('data_stream_basic')
->condition('id', $data_stream->id())
->execute();
}
}

0 comments on commit 7925b5c

Please sign in to comment.