ezmigrationbundle icon indicating copy to clipboard operation
ezmigrationbundle copied to clipboard

unable to use the remote_id for update content_type

Open jbcr opened this issue 5 years ago • 4 comments

In the DSL doc, I can use the content class remote_id in the match section into my migration.

But, if I want execute the migration, I have this error:

Migration failed! Reason: Error in execution of step 1: ContentType can not be matched because matching condition 'remote_id' is not supported. Supported conditions are: all, and, or, not, contenttype_id, contenttype_identifier, id, identifier in file vendor/kaliop/ezmigrationbundle/Core/Matcher/AbstractMatcher.php line 37

jbcr avatar Aug 08 '19 13:08 jbcr

You are right.

In fact, looking in the code, I see that this feature was enabled in the past, then commented out - but forgotten in the docs as 'available'.

The reason is found in a comment in the code: disallowing matches by remote_id allows us to implement KeyMatcherInterface without the risk of users getting confused as to what they are matching...

In other words: there are places where a match for a ContentType is done using a single value which can be either an integer (id) or a string (ct identifier). This is slightly different from, say, matching Contents or Locations, where matching on a single value will either look for id (for integers) or for remote_id (for strings). The current thinking is that, if we allow to match CTs by remote_id in some places, developers might expect to be matching on remote_id by default when matching a string value, instead of matching on identifier.

Since there now seems to be at least a user who is asking for matching on remote_id, I am open to revisit this decision. A possible compromise would be to keep matching on identifier if a single string value is passed, and match on remote_id only when the user expressly asks for it - and make sure that this is well documented in the docs...

gggeek avatar Aug 09 '19 18:08 gggeek

Another answer is update the documentation because the identifier field is like remote_id (the same on each environment).

jbcr avatar Aug 12 '19 12:08 jbcr

As you wish... do you need yo use the remote_id field or is identifier enough? In my experience, usage of remote_id is only necessary when sync with a remote system is at play...

gggeek avatar Aug 12 '19 20:08 gggeek

@gggeek In my case, the identifier is the same in all environment and is not used on remote system. Well, I have solved my problem with the field identifier.

But, I like use the remote_id because is generaly it's unique.

jbcr avatar Aug 13 '19 14:08 jbcr