Problem/Motivation

The message property is not currently defined as a property on the migrate executable. As such is is provided as a public property. This is sort of a defacto API since the executable is injected into most signatures and it provides a way to provide migrate messages.

Proposed resolution

Add the property so PHP can do its property optimizations and IDE's can see the documentations.

Comments

neclimdul created an issue. See original summary.

Status: Needs review » Needs work

The last submitted patch, add_migrate_executable_message_property.patch, failed testing.

neclimdul’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new643 bytes

Apparently we have to rely on MigrateExecutable to get the messaging object into a bunch of places where we don't explicitly supply it in the interface. Its not a service on the container so there isn't much we can do without refatoring a bunch our APIs... Public it is.

heddn’s picture

Status: Needs review » Needs work
+++ b/core/modules/migrate/src/MigrateExecutable.php
@@ -95,6 +95,13 @@ class MigrateExecutable implements MigrateExecutableInterface {
+  public $message;

Why public? Can we use protected? Or explain why it is public?

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Charlotte17’s picture

Issue summary: View changes
StatusFileSize
new520 bytes
new643 bytes

Changed a file public function to protected in #3

heddn’s picture

Issue summary: View changes
Status: Needs work » Reviewed & tested by the community

I'm going to assume this comes back green.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 6: add_migration_message-2778445-6.patch, failed testing.

mikeryan’s picture

Issue summary: View changes

So, an issue summary would have helped... The point is that the public $message is actually being accessed from outside the executable, and this issue is merely trying to document it. The real problem is that the lower-level APIs are trying to talk directly to the front-end via the message interface, which they shouldn't - that should be the executable's job - but, it's not personally a priority to fix that right at this point.

mikeryan’s picture

Issue summary: View changes

Oh, didn't even notice it failed to apply, I was expecting test errors (which I still expect to see if rerolled to apply).

And, looking at the patches - it seems they're backwards - the real patch is labelled as the interdiff and vice versa.

neclimdul’s picture

Version: 8.2.x-dev » 8.3.x-dev
Issue summary: View changes
Status: Needs work » Needs review
neclimdul’s picture

That comment summary looks like its full of lies. The patch from #3still applies so I was hiding the other patches and providing the requested summary.

heddn’s picture

Status: Needs review » Reviewed & tested by the community
Charlotte17’s picture

Thank you neclimdul for correcting error

neclimdul’s picture

No problem. It was my fault for not writing the summary.

neclimdul’s picture

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

So let's do this properly keep it public but add a @todo pointing to another issue to make it protected and add an @deprecated saving this is going to be made protected and tell the user which methods on the migrate executable to use.

imiksu’s picture

Issue tags: +Needs reroll

Patch isn't applying against 8.3.x. Seems also like an novice issue.

$ curl https://www.drupal.org/files/issues/add_migration_message-2778445-6.patch | patch -p1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   520  100   520    0     0    907      0 --:--:-- --:--:-- --:--:--   907
patching file core/modules/migrate/src/MigrateExecutable.php
Hunk #1 FAILED at 99.
1 out of 1 hunk FAILED -- saving rejects to file core/modules/migrate/src/MigrateExecutable.php.rej
anish.a’s picture

Issue tags: -Needs reroll
StatusFileSize
new643 bytes

I have re rolled the patch for 8.3.x.
If I can get the issue number mentioned in #17 , I can update the patch with @todo and @deprecated tags.

anish.a’s picture

Status: Needs work » Needs review
StatusFileSize
new643 bytes

Uploading patch again as tests are not working

anish.a’s picture

imiksu’s picture

Issue tags: +DCampBaltics

Lets try to review this today.

imiksu’s picture

Status: Needs review » Needs work

Rerolled! Now, comments in #17 still apply.

So let's do this properly keep it public but add a @todo pointing to another issue to make it protected and add an @deprecated saving this is going to be made protected and tell the user which methods on the migrate executable to use.

imiksu’s picture

arturs.v’s picture

StatusFileSize
new716 bytes
new524 bytes

I`m assuming that @deprecated tag is going to get added by the followup issue. We however didn`t find which method to use instead. @alexpott can you specify?

A.

biguzis’s picture

Status: Needs work » Needs review
mikeryan’s picture

Status: Needs review » Reviewed & tested by the community
Related issues: +#2822663: Convert MigrateExecutable::$message to protected property

Right, it makes sense to add the @deprecated when we have the preferred method to point to (in the followup).

This looks good, thanks!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 4471e30 to 8.3.x and abb08c9 to 8.2.x. Thanks!

diff --git a/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php
index 4fa099b..9c27514 100644
--- a/core/modules/migrate/src/MigrateExecutable.php
+++ b/core/modules/migrate/src/MigrateExecutable.php
@@ -97,7 +97,7 @@ class MigrateExecutable implements MigrateExecutableInterface {
   /**
    * Migration message service.
    *
-   * @todo Make it protected: https://www.drupal.org/node/2822663
+   * @todo https://www.drupal.org/node/2822663 Make this protected.
    *
    * @var \Drupal\migrate\MigrateMessageInterface
    */

Swapping this around to make it more like other @todo's and I just prefer it :)

  • alexpott committed 4471e30 on 8.3.x
    Issue #2778445 by neclimdul, anish.a, Charlotte17, arturs.v, iMiksu,...

  • alexpott committed abb08c9 on 8.2.x
    Issue #2778445 by neclimdul, anish.a, Charlotte17, arturs.v, iMiksu,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.