Remove duplicate declaration of Views base table #3025
Merged
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.
When a content entity is generated it currently shows up twice in the "Add view" wizard:
One of the two entries doesn't work correctly, when it is selected it is not possible to select any of the fields on the entity to use in the view.
I had a look and this appears to happen due to an additional base table being declared in
MyEntityViewsData::getViewsData()
. When I delete this section and simply use the default output from the parent class then it works as expected; core seems to handle it fine.It's not clear to me why this additional base table was added. This was originally added in Issue #2358493: Integration with Views for entity content generated back in 2014 but I could not find a clear explanation of why it was necessary to declare an additional base table. I suppose it was working around a bug that was still present in the early days of D8 beta, but has since been resolved.
This now means that the entity
MyEntityViewsData
class is in fact no longer used / needed. I have put a placeholder text in it but maybe it is even a good idea to remove this file entirely?