Problem/Motivation
Core Migration Source classes cannot be easily extended because of the use of short hand database field notation on query conditionals. Causing Fatals because of ambiguous field names.
Proposed resolution
Go through each module and update the source classes to have the verbose naming convention of "alias.field" for conditional statements.
Original report
Essentially, To be able to extend the query on the D7 User source, I have to Rebuild the query because uid is used all over the place. I suggest we make the conditions explicit and use the alias in the field name so the query can be extended. You can see this in core/modules/user/src/Plugin/migrate/source/d7/User.php:22
Raised from IRC
mikeryan1 No need to duplicate the D7 user query, do $query=parent::query() and add the role filtering to it
generalredneck mikeryan1: doesnn't work
because you do uid ono the condition in the main class
not u.uid
and uid is in both users_roles and users table
mikeryan1 generalredneck: Ugh, that’s a bug in the d7_user source plugin then, it should specify u.uid so it’s extendable
Comments
Comment #2
generalredneckComment #3
generalredneckComment #5
generalredneckFixed the Parse Error. Not enough dots.
Comment #6
heddnThere are already tests that cover this. This doesn't have any side-effects so putting this into 8.1 seems fine. Marking RTBC after reviewing the code. Everything seems fine.
Comment #7
mikeryanCoding standard - should be spaces around the . operator (can be fixed on commit).
As for tests... Well, I'm OK with it as-is, but the case might be made for a test demonstrating the use case (extended a source plugin and being unable to do a join due to the unaliased reference). But, adding such a test for each instance covered here seems like way overkill....
Comment #8
alexpottCommitted 806f35e and pushed to 8.1.x and 8.2.x. Thanks!
Fixing coding standards on commit.