**TROUBLESHOOTING**
* If your menu children aren't showing up, check the following
- Are you providing the correct parent ID in your contextual filter? The
simplest way to do this is to select:
"Provide default value" -> "Content ID from URL"
But when I do that, I get
Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'nid' in where clause is ambiguous: SELECT node.nid AS node_nid, node_field_data.nid AS nid FROM {node_field_data} node_field_data INNER JOIN {node} node ON node_field_data.nid = node.nid WHERE (( (nid IN (:node_menu_children_filter__0)) )AND(( (node_field_data.status = :db_condition_placeholder_0) ))); Array ( [:db_condition_placeholder_0] => 1 [:node_menu_children_filter__0] => 18 ) in Drupal\Core\Database\Connection->handleQueryException() (regel 668 van /core/lib/Drupal/Core/Database/Connection.php).
I haven't sorted on weight or anything.
If I have no contextual filter, all nodes are showing (offcourse).
Comment | File | Size | Author |
---|---|---|---|
#6 | 2864346-change-reference-to-table.patch | 695 bytes | jeremygrajales |
#4 | views.view_.first_level_menu.yml | 9.75 KB | fotograafinge |
Comments
Comment #2
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commentedHmm, I definitely see the problem with the query, but I'm not positive where it comes from yet. Could you export your view (or a simplified one if it relies on a lot of other things) and add post the .yml? Or if it's a really simple view, could you post reproduction steps from a scratch? Thanks!
Comment #3
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commentedComment #4
fotograafinge CreditAttribution: fotograafinge commentedJust a real simple view.
An unsorted list of fields, no filters, no relations, nothing special.
Comment #5
jeremygrajales CreditAttribution: jeremygrajales commentedI'm also seeing this issue.
If my view is using fields and I only list the "title" of the node, everything returns fine.
In my case, I need the path alias of the node as well. Adding this field results in the same exception from OP.
Comment #6
jeremygrajales CreditAttribution: jeremygrajales commentedThis patch works for me
Comment #7
fotograafinge CreditAttribution: fotograafinge commentedthx @jeremygrajales, that patch solves the problem !!
the patch from #6 works for me too
Comment #8
jeremygrajales CreditAttribution: jeremygrajales commentedIt only works if you're using a node field in your view (which is most cases where you would run into this issue).
If you're using just the title field, Drupal doesn't do a join on the node table and this patch will cause another exception.
I don't have a lot of exp. with Views API, so maybe someone can find a better solution?
Comment #9
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commentedThanks for the patch! This problem hadn't appeared for me because I usually use rendered entities in my views.
That little snippet of code that defaults to "nid" if there's no table alias, I think a better solution for that might be needed altogether. It doesn't seem like that should be needed, but when I was testing originally there was not always a table alias specified. I feel like there should be a better solution for assigning the name to that field in the query, however, that doesn't involve a conditional at all.
I may not have time to look more into this until next week, finishing up a big project at the moment, however if anyone else finds a solution to that before me (or finds that I'm wrong and we need that conditional after all), that'd be great as well.
Comment #10
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commentedComment #11
cravecode CreditAttribution: cravecode commentedThis should be fixed in the 7.x work i'm bringing into 8.x. I hope to have the 8.x dev branch updated this week.
Comment #12
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commentedSounds great! Unassigned from me for now until you bring that code over and we see if this is resolved.
Comment #13
cravecode CreditAttribution: cravecode commented@fotograafinge, can you please test out the new 8.x-2.x branch?
Comment #14
cravecode CreditAttribution: cravecode commentedComment #15
cravecode CreditAttribution: cravecode commented@fotograafinge, can you try the latest 8.x beta?
Comment #16
cravecode CreditAttribution: cravecode commented@fotograafinge hasn't responded. @bmcclure where you able to reproduce this? If so, do you know if it's fixed in the latest beta?
Comment #17
fotograafinge CreditAttribution: fotograafinge commentedI'm sorry. Will check it asap!
Comment #18
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commentedI wasn't able to reproduce myself previously btw. I hope that means it's been fixed since, but perhaps @fotograafinge can let us know for sure.
Comment #19
cravecode CreditAttribution: cravecode commentedI'm closing this issue. With the latest work, the join is handled very differently.
Comment #20
cravecode CreditAttribution: cravecode commented