I'm migrating recipes from an api into Drupal 8. I have a field "field_recipe_ingredients" Text(formatted) Allowed number of values: unlimited
In the process plugins when I have the following value:
field_recipe_ingredients: ingredients
it works fine
When I put the following:
'field_recipe_ingredients/value': ingredients
'field_recipe_ingredients/format':
plugin: default_value
default_value: 'full_html'
it fails with the following error:
InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in [error]
Drupal\Core\Database\Connection->expandArguments() (line 719 of
/Users/selwyn.polit/Sites/d8_test1/drupal/core/lib/Drupal/Core/Database/Connection.php).
exception 'PDOException' with message 'SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'sourceid1' at[error]
row 1' in /Users/selwyn.polit/Sites/d8_test1/drupal/core/lib/Drupal/Core/Database/Statement.php:64
Ingredients returns a simple array of strings.
Any thoughts welcome!
Comments
Comment #2
mikeryanMy guess here is that there's a mismatch between the /value, which is being populated with an array, and /format, which is being populated with a scalar - when trying to assign a format to each value, it's trying to dereference an array that isn't an array. It would be nice if the situation was interpreted as "apply this scalar value to every member of the array", but that's not how it's implemented, not sure how hard that would be.
A possible workaround may be for your source plugin to populate a 'format' array which a 'full_html' value for each ingredient, and map 'format' to 'field_recipe_ingredients/format'.
Comment #3
quietone CreditAttribution: quietone as a volunteer commentedComment #4
rodrigoaguileraI found a related bug that might help you solve this one
#2789125: Error when a process plugin gives a multiple value for a subproperty destination
Comment #7
mikeryanActually, having run into these situations in recent months, the iterator plugin addresses this nicely: