Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
A developer may need to alter migrate queries that obtain field values.
At present the way to alter this queries for Drupal 6 sources is by subclassing Drupal\node\Plugin\migrate\source\d6\Node
. In Drupal 7, the option is going a insane path and subclass any entity migration that extends Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity
.
Proposed resolution
Tag the queries.
Remaining tasks
* Review patch.
* (?) Document the new hooks somewhere.
User interface changes
None.
API changes
New hooks available.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#2 | tag-migrate-field-data-queries-2842939-1.patch | 2.72 KB | jonhattan |
Comments
Comment #2
jonhattanComment #3
phenaproximaSelf-assigning for review.
Comment #4
phenaproximaWhy did this change?
Overall, I feel like the scope of this patch is too small. It seems like it was written specifically to scratch a particular itch, but not to actually be useful across the entire Migrate system. I think it needs to be fleshed out more, and it will also need tests.
I'm not sure how I feel about these tags. They seem oddly specific. I feel like all Migrate queries should get the 'migrate' tag to begin with, and then additional tags on top of that.
Same here.
Comment #5
jonhattan1. This change is for IDE happiness. Without it, $query object is cast to ConditionInterface instead of SelectInterface.
Is it better to annotate the variable instead?
2a. I don't think it is specific to a particual itch. It allows to alter a concrete query and enables developers to intervene in the migrations significantly. Some use cases I'm already working with:
2b. I can agree it is small. It could be extended to add tags to all of migrate queries. At present the only tagged migrate query is Drupal\migrate\Plugin\migrate\source\SqlBase.
Should we change the scope of this issue to tag all migrate queries, or to identify which ones are eligible to be tagged?
3. Which tags. The ones I've used seems reasonable to me. They identify the query. Indeed I think it is also useful to add at least migrate_field_values_FIELD_NAME.
Should we add
migrate
andmigrate_MIGRATION_ID
to all tagged queries? How much specific we want to be?Comment #7
heddnI tend to agree with the feedback in #4. This can be easily fixed by extending the source plugins. I'm tempted to mark this as won't fix.