Comments

quietone created an issue. See original summary.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

masipila’s picture

Issue tags: +API Documentation
masipila’s picture

masipila’s picture

StatusFileSize
new2.87 KB

Initial patch attached.

This is intentionally including the 'custom_article_migration' migration in addition to the actual 'custom_article_revision_migration' instead of referring to the very similar example provided in EntityContentBase, see #2862662: Add documentation to EntityContentBase destination plugin

The reason for having a separate node migration example here is that:

  • The example provided in EntityContentBase demonstrates the configuration keys. This revision example can be more minimalistic and only focus on the revision migration specific things. Therefore I wrote the patch so that we are only referring to the parent class EntityContentBase and saying that the configuration keys are documented there.
  • The example provided in EntityContentBase does not include the revision id (vid for nodes). This was intentional because the purpose there was to only show the most simple node migration without revisions.

Cheers,
Markus

masipila’s picture

Status: Active » Needs review
masipila’s picture

Added the relation to EntityContentBase destination plugin API doc improvements. These two patches should be preferably be committed at the same time.

Markus

quietone’s picture

Status: Needs review » Needs work

The approach taken on this, see #5, works for me. It keeps the examples focused on the piece at hand without a lot of extraneous information.

Just two small nits.

  1. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -14,6 +14,80 @@
    + * means that when you are going to migrate revisions, also the entity migration
    + * should include revision IDs.
    

    This just sounded funny when I read it. Maybe 'means that when migrating revisions, the entity migration should include the revision IDs.' ?

  2. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -14,6 +14,80 @@
    + * sake of simplicity.
    

    And simply a suggestion here to add "Note that the revision ID is included in the entity migration as well as the entity revision migration." And make it really really clear about putting the revision id in the entity migration.

masipila’s picture

StatusFileSize
new2.88 KB
new1.3 KB

Addressing both comments from #8.

Cheers,
Markus

masipila’s picture

Status: Needs work » Needs review
mohit1604’s picture

Status: Needs review » Reviewed & tested by the community

Patch looks good ! Thanks for the patch @masipila . Marking RTBC.

masipila’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.88 KB
new903 bytes

Found still two typos, attached patch fixes them.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

Last docs changes look like an improvement. LGTM.

mohit1604’s picture

I agree @heddn .

masipila’s picture

Status: Reviewed & tested by the community » Needs work

I'll change the source of the example to use embedded data source instead of EmtpySource so that this will be consistent with other examples.

jofitz’s picture

Status: Needs work » Needs review
StatusFileSize
new2.26 KB
new3.4 KB

As suggested by @masipila, replaced the EmptySource with an embedded data source.

masipila’s picture

Status: Needs review » Needs work
Issue tags: +Migrate January 2018 Sprint
+++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
@@ -14,6 +14,70 @@
+ * source:
+ *   plugin: d7_node

We need this source plugin in the example: https://api.drupal.org/api/drupal/core!modules!migrate!src!Plugin!migrat...

masipila’s picture

Status: Needs work » Needs review
StatusFileSize
new2.89 KB
new3.27 KB

Here we go with embedded data source. I also incorporated the better labels for both examples from Jo's patch into this.

quietone’s picture

Status: Needs review » Needs work

Sorry, a few questions.

  1. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -14,6 +14,88 @@
    + * In order to avoid revision ID conflicts, make sure that also the entity
    

    Can 'make sure ...' be 'make sure that the entity migration also includes the revision ID.'

  2. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -14,6 +14,88 @@
    + * simplicity. The important part of both examples is the 'vid' property which
    

    Very nice, explaining what 'vid' means.

  3. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -14,6 +14,88 @@
    + *   nid: nid
    + *   vid: vid
    

    Should these be using migration_lookup? Or maybe another example or comment. I don't know, I am asking.

Edit: fixed a typo

jofitz’s picture

Status: Needs work » Needs review
StatusFileSize
new2.9 KB
new889 bytes

1. Made suggested change.
3. I see your point, @quietone, that would be a regular use case, but I think this version is still valid (and keeps it as simple as possible). In reality I think it is unlikely anyone would use the embedded_data plugin with this destination plugin, but it provides a simple example.

masipila’s picture

Status: Needs review » Needs work

Re #19.3. Nid could and should be mapped with migration_lookup. Vid can not because this migration creates the revisions.

masipila’s picture

Assigned: Unassigned » masipila

Working on this now.

masipila’s picture

Assigned: masipila » Unassigned
Status: Needs work » Needs review
StatusFileSize
new2.99 KB
new626 bytes

And here we go. The revision example is now using migration_lookup to map the nid property.

phenaproxima’s picture

Status: Needs review » Needs work

Thanks for taking this on, @masipila! Looking quite good right out of the gate.

  1. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -14,6 +14,91 @@
    + * Entity revision migration must always be a pair of the corresponding entity
    + * migration. For example, revisions of given node content type can be migrated
    

    Can we rephrase this first sentence? Something like "Entity revisions can only be migrated after the entity to which the revisions belong has been migrated." Also, "node content type" is redundant; we can just say "content type".

  2. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -14,6 +14,91 @@
    + * In order to avoid revision ID conflicts, make sure that the entity migration
    + * also includes the revision ID.
    

    Can we elaborate on this at all? It sounds very ominous, but is not really explained.

  3. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -14,6 +14,91 @@
    + * simplicity. The important part of both examples is the 'vid' property which
    

    We need a comma after the word "property".

  4. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -14,6 +14,91 @@
    + * is the revision ID property for nodes.
    

    We can remove the word "property" here.

  5. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -14,6 +14,91 @@
    + * Example for node migration:
    

    Should say "Example of a base node migration, which must run before the revision migration", or similar.

  6. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -14,6 +14,91 @@
    + * Example for corresponding node revision migration:
    

    Maybe "Example of the corresponding revision migration, which must be run after the above migration"?

masipila’s picture

Assigned: Unassigned » masipila
masipila’s picture

Assigned: masipila » Unassigned
Status: Needs work » Needs review
StatusFileSize
new3.37 KB
new2.25 KB

1-6: Done.

phenaproxima’s picture

Status: Needs review » Needs work

Nearly there!

  1. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -17,19 +17,23 @@
    + * belong has been migrated. For example, revisions of given content type can be
    

    Nit: "...of a given content type..."

  2. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -17,19 +17,23 @@
    + * also includes the revision ID. If the entity migration would not include the
    

    "...entity migration did not include the revision ID..."

  3. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -17,19 +17,23 @@
    + * revision ID, the entity would get the next free revision ID (1 when migrating
    

    s/free/available.

  4. +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
    @@ -17,19 +17,23 @@
    + * to a clean database). When the revisions are then migrated after the
    

    Should be "Then, when revisions are migrated..."

masipila’s picture

Status: Needs work » Needs review
StatusFileSize
new3.37 KB
new1.49 KB

1-4: Done.

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, @masipila. First-class work as always.

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all, definitely looks like an improvement.

  • Gábor Hojtsy committed 253b102 on 8.5.x
    Issue #2862748 by masipila, Jo Fitzgerald, quietone, phenaproxima: Add...

  • Gábor Hojtsy committed 724ae1e on 8.6.x
    Issue #2862748 by masipila, Jo Fitzgerald, quietone, phenaproxima: Add...

Status: Fixed » Closed (fixed)

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