Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is it possible to replicate a single specific entity across workspaces (different sites) using this module (this API) instead of replicating all entities ?
Thanks !
Comments
Comment #2
timmillwoodYes, and no.
The UI doesn't support it yet, we are looking at adding a filter in at some point in the near future.
However the API supports it, you will see the replication library we are using supports an array of document IDs as part of the task. Therefore you could add the UUID of an entity in here and it should replicate just that one entitiy. This will not take into account any references in that entity such as users, tags, files etc, so you may get lots of weird stub entities unless you manually add the UUIDs for the references too.
Essentially this is how we plan to implement the filter.
Comment #3
DamienGR CreditAttribution: DamienGR commentedThank you for your answer. I will try to create my own Replicator (ReplicatorInterface) based on CouchdbReplicator.
Comment #4
timmillwoodThat would be cool to see, if only to test.
You could extend
CouchdbReplicator
because it's only the\Drupal\relaxed\CouchdbReplicator::replicate
method you'd need to change.Comment #5
GrimreaperHello,
I also have the need to share single content.
My environment is a Drupal 8.1.10 with the dev version of the deploy ecosystem modules. And I am testing against a couchDB 1.6.1 (inside a docker container, official image).
Before extending the CouchdbReplicator, I tried to POC the mechanism by hardcoding an uuid into CouchdbReplicator replicate() method.
Instead of:
And then if I try to deploy, I have the following errors in dblog.
Type: PHP
And
Type: Relaxed
I can't figure out how to pass a single entity to replicate.
Thanks for any help.
Comment #6
GrimreaperHum I think I found the problem:
In https://github.com/relaxedws/couchdb-replicator/blob/master/src/Replicat...
It seems that filtering on a doc ID is not supported in the relaxedws library.
PS: Nope I pass in the else statement and in this statement the doc_ids option is not commented.
Comment #7
GrimreaperHello,
I found why I got the error.
When using doc_ids the request on the _changes endpoint is now a POST and not a GET request and the Drupal\relaxed\Plugin\rest\resource\ChangesResource does not have any post method.
I am trying to implement one. Now I am stuck with this error "Could not denormalize object of type Drupal\\replication\\Changes\\Changes, no supporting normalizer found."
I will try to figure out how to solve that.
Comment #8
GrimreaperHaving too much problems with the serializer/deserializer objects.
I found that using a parameter uuids allowed to filter the _changes endpoint.
Currently for the POC I have hardcoded my UUID in the CouchdbReplicator:
I will see to pass it generically.
Comment #9
GrimreaperGoing in the process of replication, I think there is no need to extend the CouchdbReplicator.
For my use case, I think I will create a new entity form because in the save method of deploy/src/Entity/Form/ReplicationForm.php, if I add
I can filter on UUID, so in my new form I will make a table to select the content entities to deploy. Maybe with a view, I don't know yet.
Comment #10
GrimreaperHello,
I have created a functionnal sandbox https://www.drupal.org/sandbox/florenttorregrosa/2839013. I will upload the code soon.
Do you think this feature could be integrated in Deploy or should it stay a separated project?
Without response I will promote the sandbox to full project on the beginning of the next year.
Thanks for the review.
Comment #11
GrimreaperHello,
I have promoted my sandbox into a full project.
For information, I do not depend on relaxed web services and I made deploy an optional module for this feature.
Comment #12
shelaneWe would want to replicate a node or a selection of nodes and their related entities. Particularly we use paragraphs (nested as well) and that is where the bulk of the content is.