New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete data when basic data streams are deleted. Fixes #488 #489
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that we had this when we had a separate legacy
data stream bundle, but the hook_data_stream_delete
implementation got dropped with this commit: e528813
We should add a test for this so we don't forget it in the future.
This PR is nearly identical to the original code though, so LGTM otherwise!
function farm_sensor_listener_data_stream_delete(DataStreamInterface $data_stream) {
// Remove all legacy listener data provided by the data stream.
if ($data_stream->bundle() == 'legacy_listener') {
\Drupal::database()->delete('data_stream_legacy')
->condition('id', $data_stream->id())
->execute();
}
}
Added a test for this! In the process, noticed that we have the logic for removing references to data streams in the wrong place, it should be in farm_sensor. Moved the logic and added another test for this, but running into the entity reference integrity issue... so I marked the test to be skipped for now, but this still causes our test runner to fail. Gotta run but wanted to push here for now... |
05df35d
to
ac536bc
Compare
Thanks @paul121! I separated this into two branches...
I'll point to (2) from #485... Running tests on this PR ( |
Ah tests failed because Whelp... I suppose we can just delete that original code from |
Precisely - that's perfect! |
See #488