Problem/Motivation
I'm working on updating migrate_source_csv to run with >8.1.x. One of the first steps is to get my unit tests passing again. I made the simple change of swapping out the namespace on MigrationInterface. But now I find that in the constructor for SourcePluginBase, we call get(). Since get() isn't in the interface (we used to implement ConfigEntityBase, and it did then), that makes unit testing tough.
SourcePluginBase calls get() in its constructor and now my unit tests cannot Prophecy using the interface.
Proposed resolution
Based on a quick conversation in IRC with benjy, we should remove the get() calls in favor of specific getters.
Remaining tasks
Do it. Code it.
User interface changes
API changes
Adds specific getters to MigrationInterface and Migration plugin. Marks get() on Migration as deprecated as of 8.2.x.
public function getDestinationConfiguration();
public function getSourceConfiguration();
public function getHighWaterProperty();
public function getTrackLastImported();
public function getDestinationIds();
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | interdiff_9-12.txt | 1.38 KB | heddn |
| #12 | drupal-migrationinterface_getters-2694009-12.patch | 14.14 KB | heddn |
Comments
Comment #2
heddnComment #3
heddnDocs to come later. Here's a first cut at the interface update.
Comment #4
benjy commentedI suggested we deprecate get() since we inherited it previously from ConfigEntityBase and it breaks the encapsulation of the Migration class. So, +1 from me.
Comment #5
heddnAnd here's updates in all the locations, including docs.
Comment #7
heddnComment #8
vasi commentedLooks quite straightforward.
I assume this will get backported to 8.1 though, so maybe change the "@deprecated in Drupal 8.2.x" comment to say 8.1.x instead.
Comment #9
heddnComment #10
vasi commentedComment #11
alexpottThis needs to document the @return value and probably describe the keys and values of this array.
Mind you
Is not that helpful either. So we could just punt the detail to a followup - we still need to fix the @return though.
Comment #12
heddnComment #13
benjy commentedThanks
Comment #14
alexpottCommitted 17bb1cd and pushed to 8.1.x and 8.2.x. Thanks!
Comment #17
codebymikey commentedThe deprecation of this method removes access to the
$requirementsproperty which is used by contrib modules such as migrate_tools.Another property which doesn't have an equivalent getter is
$dependencies.Is there any upgrade plans for them in Drupal 9?