- Issue created by @mhentry
- πΊπΈUnited States danflanagan8 St. Louis, US
The reason for the exception is that `condition` is being interpreted as a destination key in your second sub_process. So it ends up looking for a process plugin called `in_array` to process that value.
I am a little confused about the goal here. If you post an example of the source data I might be able to offer more help.
- π¨π¦Canada mhentry Toronto
@danflanagan8, please see the attached image, sorry for privacy I hide the user information. following is my working migrate yml which gets the contact number without any condition both phone number and fax.
_phoneList:
plugin: sub_process
source: positionList
process:
phoneList:
plugin: sub_process
source: phoneList
process:
phoneNum: phoneNumfield_phonenum_office:
-
plugin: flatten
source: '@_phoneList' - πΊπΈUnited States danflanagan8 St. Louis, US
It looks like the "Office" and "Fax" flags are in the
type
property that is siblings with thephoneNum
property. You're going to have to refer totype
at some point.You might consider the filter_on_condition β process plugin along with the has_element β condition to separate the "Office" arrays from the "Fax" arrays.
If I did this:
_officePhoneList: plugin: filter_on_condition source: phoneList condition: plugin: has_element index: type condition: equals(Office)
using your example data I would end up with
_officePhoneList = [ [ phoneNume => redacted, extension => NULL, voicemailInd => TRUE, smsInd => FALSE, type => "Office" ] ]
- π¨π¦Canada mhentry Toronto
@ Thank you for the help, while I am trying your YAML, i am getting following error.
The "has_element" plugin does not exist. Valid plugin IDs for Drupal\migrate\Plugin\MigratePluginManager are:" am I missing something ?
- πΊπΈUnited States danflanagan8 St. Louis, US
It sounds like
has_element
is being interpreted as a process plugin, likely because the yaml is nested within a sub_process and something isn't quite right. - πΊπΈUnited States danflanagan8 St. Louis, US
I don't think I'll be able to provide any real help. It looks a little tricky. There's a sub_process inside a sub_process. That gets hard to understand.
Sometimes if your source data is hard to work with, it is better to modify the source plugin than to use a complicated process pipeline. Or sometimes writing a single custom process plugin can be easier than trying to chain together a bunch of existing process plugins.
Sorry I couldn't be more help. Good luck!
- π¨π¦Canada mhentry Toronto
@danflanagan8, I managed to get it work by moving the sub_process after the condition by referring this https://www.drupal.org/docs/8/api/migrate-api/migrate-process-plugins/mi... β
Thanks a lot!!!
_officePhoneList:
plugin: sub_process
source: positionList
process:
phoneList:
-
plugin: filter_on_condition
source: phoneList
condition:
plugin: has_element
index: type
condition: equals(Office)
-
plugin: sub_process
process:
phoneNum: phoneNum - Status changed to Fixed
about 1 year ago 8:53pm 1 November 2023 - πΊπΈUnited States danflanagan8 St. Louis, US
That's great news! I'll close this then. Cheers!
Automatically closed - issue fixed for 2 weeks with no activity.