Issue #1848 EmitFileEvent.php: Call to undefined function getFileUri() #838
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Github Issue: EmitFileEvent.php: Call to undefined function getFileUri()
What does this Pull Request do?
Adds an explicit check before calling a function that can be on a Media or File entity type.
What's new?
The event generation that happens after a context reaction to index an external file in fedora accepts entity types that are either Media or File objects. The generateData function assumes that the object is always a File when it checks to make sure the fedora:// URI does not have one-too-many slashes in it.
This change simply explicitly checks if a getFileUri() function exists before calling it.
How should this be tested?
Follow the steps to reproduce in the linked GitHub issue, namely: Create a Media such as Image in a fresh Islandora install.
Check that all derivatives are generated, and look in the Watchdog log to ensure that the error that the getFileUri() function does not exist is no longer reported.
, @Islandora/8-x-committers