Problem/Motivation
The current doc block for MigrateDestinationInterface::import()'s return value reads:
* @return mixed
* The entity ID or an indication of success.
*/
This is is incorrect. The return value should be array|bool. The method should return an array of destination ids indexed in the same order as they are defined in MigrateDestinationInterface::getIds() to save the ids to the idmap, or TRUE to report success and not save IDs to the idmap (such as for configs) or FALSE to indicate an error.
There is no situation where the plugin would return a scalar entity id as it would throw an error when the idmap attempted to iterate over it. It is also impropert to assume that a destination is even saving an entity, we shouldn't make any assumptions about what the destination plugin is doing.
All core plugins already have return values that meet this criteria.
Proposed resolution
Update the documentation to be clear.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#11 | interdiff_9-11.txt | 839 bytes | Neslee Canil Pinto |
#11 | 3074047-11.patch | 978 bytes | Neslee Canil Pinto |
#9 | interdiff_7-9.txt | 994 bytes | Neslee Canil Pinto |
#9 | 3074047-9.patch | 978 bytes | Neslee Canil Pinto |
#7 | interdiff_2-7.txt | 1.01 KB | Neslee Canil Pinto |
Comments
Comment #2
mikelutzComment #3
xjmComment #5
daffie CreditAttribution: daffie commentedThis is a migration issue.
Comment #6
quietone CreditAttribution: quietone as a volunteer commentedYes, this does improve the documentation. I like it.
Comment #7
Neslee Canil PintoChanges ids to id's.
Comment #8
quietone CreditAttribution: quietone as a volunteer commentedI don't understand why id is changed to the possessive form it really is a plural. But the change caused me to take a take a second look and I realize that it should be IDs. So, I think it should be 'destination IDs'.
Comment #9
Neslee Canil PintoComment #10
quietone CreditAttribution: quietone as a volunteer commentedThanks for the change! You may not believe this but now I see that 'id map' should be 'ID map' (there are two instances of that).
Really sorry for not seeing that earlier. (I must admit that 17 days of lockdown does have an adverse effect on me).
Comment #11
Neslee Canil PintoMade changes from #10
Comment #12
quietone CreditAttribution: quietone as a volunteer commentedThanks very much Neslee Canil Pinto!
This looks fine to me now, the capitalization of ID is correct everywhere and the explanation of the returned value is correct.
Comment #13
alexpottCommitted and pushed bbbed21e90 to 9.1.x and 1ad04e7c6f to 9.0.x and 638a526694 to 8.9.x and f33a51be4f to 8.8.x. Thanks!
As this is a documentation fix I've backported this to all the current branches.