Hi, I was setting up a migration and not getting the correct sourceMigration (I was using the class name, not machine name). Running the result ended up with an exception with a not particularly helpful message.
I tracked this down to some code that assumes Migration::getInstance() succeeded, and so would try to call functions on (null).
I've attached one possible patch, which just checks that there is an object -- it works for me anyway. There's no need for a message: there is already a message in the buffer but it's not printed because of the exception. The second hunk in the diff is slightly unfortunate: it's just a new 'if ()', but the changed indentation makes it look bigger.
Hope this helps.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 0001-Make-Migrate-code-more-helpful-in-prescence-of-bad-#004.patch | 2.53 KB | rivimey |
Comments
Comment #1
mikeryanBe sure to set the status to "Needs review" when submitting a patch for review.
Comment #3
mikeryanIf you unset $source_migrations[$key] here, you don't have to worry about checking for a valid $source_migration below. Alternatively, after this loop you can do $source_migrations = array_filter($source_migrations).
Comment #4
rivimeyI've rerolled the same patch with the patch filenames modified; hopefully this will now apply.
Comment #5
rivimeyComment #6
mikeryanBe sure to set the status to "Needs review" for the testbot to test the changes, and alert humans there's a patch to review.
Comment #8
mikeryanCommitted (with the suggested improvment in #3), thanks!
Comment #9
mikeryan