- Issue created by @m.stenta
- Merge request !6Issue #3387591: Add an option to automatically assign unique ids to rows β (Open) created by m.stenta
- last update
over 1 year ago 16 pass - Status changed to Needs review
over 1 year ago 1:33pm 15 September 2023 - πΊπΈUnited States m.stenta
Opened a MR for review. It is a relatively simple addition.
- πΊπΈUnited States m.stenta
I started to add automated tests for this, but it turned out to be a bit difficult because of #2791041: Migrate source plugins should use dependency injection β .
Right now my proposed change uses
\Drupal::service('uuid')
instead of dependency injection because of that, and that makes testing more difficult. I need to learn the proper way to do that... - Status changed to Closed: won't fix
over 1 year ago 6:34pm 15 September 2023 - πΊπΈUnited States m.stenta
Update: we are probably not going to end up using this approach after all. It still accomplishes the goal that I described above, so it might be useful for someone else, but it turned out that we needed to do something even more complicated in our context which meant taking a slightly different approach (and extending `CSV` with our own source class).
So I will close this as "won't fix" - but if anyone else finds it useful and wants to push it forward please feel free to reopen!
- First commit to issue fork.
- Status changed to Needs review
6 months ago 6:17pm 11 June 2024 - π¬π§United Kingdom AndyF
Thanks, I was looking for just that! I've made some updates:
- Use
create_record_uuid
as the boolean andrecord_uuid_field
as the field name for consistency withcreate_record_number
andrecord_number_field
. - Don't force the ID to be the UUID. (I figured it's a little more flexible this way.)
- Add a section to the unit test for this.
I've updated
\Drupal\migrate_source_csv\Plugin\migrate\source\CSV::__construct()
in a non-BC way. Per Drupal BC policy I think it's not considered public, and a number of people recommend extendingcreate()
instead ofconstruct()
, so I thought it might be ok to keep it simpler and not add a deprecation.Thanks!
- Use
- π¬π§United Kingdom AndyF
We'll want to add something to the release notes about changing the constructor signature.