Problem/Motivation
I am getting the following exception
InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments() (line 860 of core/lib/Drupal/Core/Database/Connection.php).
Drupal\Core\Database\Connection->query('SELECT node_field_data.nid AS "nid", NULL AS "node_field_data_published_at", "related_content:2_sector_or_technology" AS "_view_id", NULL AS "_order_0", 0 AS "_combine_sort"
FROM
{node_field_data} "node_field_data"
INNER JOIN {node} "node" ON node_field...
which is caused by an incorrect concatenation of a token and s placeholder. Here it goes -
When the Core Views module builds a query, it creates placeholders along with their values - to be "flattenet" later in a process.
some of them a single-value - like so -
:node__field_sector_field_sector_target_id = 11339
some of them have arrays of values -
:views_join_condition_5[] = ["video", "finance_option_landing_page"]
later, when it's time to "expand arguments", the Connection object will be looking for [] at the end of a placeholder if it needs to be expanded into multiple scalar placeholders.
Currently, in ViewsCombiner->setArguments in order to set unique argument placeholders, the view name (the "key") is always added at the end, thus creating an invalid placeholder
:views_join_condition_5[]_related_content_2_sector_or_technology = ["video", "finance_option_landing_page"] --- this will crash!
Proposed resolution
to check the argument/placeholder, and if it has [] at the end - add the view name before the [], like so -
:views_join_condition_5_related_content_2_sector_or_technology[]
where related_content_2_sector_or_technology is the view name and :views_join_condition_5[] was the original placeholder
User interface changes
none
API changes
none
Data model changes