Problem/Motivation
The flag_bookmark view is broken, is not installed automatically when the module is enabled and when you install it manually and go to /bookmarks a fatal error appears.
Drupal\Core\Database\DatabaseExceptionWrapper: Exception in flag_bookmark[flag_bookmark]: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= '1') AND (.uid IS NOT NULL ) ))) subquery' at line 2: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {node} node INNER JOIN {users_field_data} users_field_data_node_field_data ON uid = users_field_data_node_field_data.uid WHERE (( (.status = :db_condition_placeholder_0) AND (.uid IS NOT NULL ) ))) subquery; Array ( [:db_condition_placeholder_0] => 1 ) in Drupal\views\Plugin\views\query\Sql->execute()
So this is related to #2448881: Adding relationship to user views does not work $this->tableAlias is empty, and there is no join.
Proposed resolution
Update the flag_bookmarks view.
Remaining tasks
Create patch.
User interface changes
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#18 | splitOffSchemaFixes.patch | 7.12 KB | socketwench |
#10 | flag_bookmark_view_is-2562971-10.patch | 8.86 KB | edurenye |
| |||
#9 | flag_bookmark_view_is-2562971-9.patch | 14.42 KB | edurenye |
| |||
#5 | flag_bookmark_view_is-2562971-5.patch | 9.01 KB | edurenye |
| |||
#5 | flag_bookmark_view_is-2562971-5-test_only.patch | 1.95 KB | edurenye |
|
Comments
Comment #2
socketwench CreditAttribution: socketwench as a volunteer commentedPostponing until #2448881: Adding relationship to user views does not work is fixed.
Comment #3
socketwench CreditAttribution: socketwench as a volunteer commentedStashing some work here to update the view while working on another issue.
Comment #4
edurenye CreditAttribution: edurenye at MD Systems GmbH commentedThis issue is fixed, so we can work on it again.
And this patch was empty.
Comment #5
edurenye CreditAttribution: edurenye at MD Systems GmbH commentedI think that the problem here is that in FlagViewsFilter doesn't have set the relationship, so the ensureMyTable set tableAlias to NULL, that's why is doing "(.uid IS NOT NULL)"
Requiring this relationship we don't need the filter anymore, so set to required and deleted the filter from the view.
This is the result:
Also fixed the buildOptionsForm and added the schema for the filter, I'm not sure if I have to fix it or we should drop the filter directly.
I think we can add tests here with check config schema disabled an enable it in this issue #2555365: Add views schema for flag_relationship.
Comment #7
BerdirInteresting, the bookmark flag has configuration enabled for article and page node types, but we can enable it when those don't exist. We're either missing calculateDependencies() implementations on those plugins or haven't updated the default config there. Not a problem if this issue, but it's going to bite us at some point when we implement that properly, then a) tests like this won't work anymore and b) the module won't be installable on non-standard based install profiles.
missing docblocks.
I think we should either leave out the config scheme here completely or we should just include the remaining part of the config schema fix from the other issue in either. The current state of adding a bit of config schema but not actually testing it seems a bit weird.
Comment #8
joachim CreditAttribution: joachim commented> We're either missing calculateDependencies() implementations on those plugins
Very likely!
Comment #9
edurenye CreditAttribution: edurenye at MD Systems GmbH commentedOk in case, I'll upload the two patches, this is with the schema errors fixed from this issue #2555365: Add views schema for flag_relationship.
Adding the bookmark view has apeared new schema errors that I had to fix.
Comment #10
edurenye CreditAttribution: edurenye at MD Systems GmbH commentedHere the second patch without schema fix.
Comment #11
martin107 CreditAttribution: martin107 commentedI am limiting this review to just the new test ( FlagBookmarkUITest )
Yep, looks clean -- it will prevent recurrences of the problem - so +1 from me!
Also phpcs reports no cs snafu's
Comment #12
dswier CreditAttribution: dswier commentedConfirming that flag_bookmark_view_is-2562971-10.patch works for me. I now get the Flag Bookmark List view after enabling flag_bookmark.
Comment #13
BerdirI think this is ready.
It's up to @joachim to decide which patch to commit. #9 includes the schema fixes from that other issue already and we could just close this or #10, which is with config schema checking disabled, then we need to reroll the other issue and just remove the disabled flag in the test.
Comment #17
socketwench CreditAttribution: socketwench as a volunteer commentedSince this has sat for over month, I decided to take the smaller patch. We will need to split off the related fixes into a separate issue.
Comment #18
socketwench CreditAttribution: socketwench as a volunteer commentedRemaining fixes for reference.
Comment #19
socketwench CreditAttribution: socketwench as a volunteer commented