acbramley / entity_pilot_err

Provides integration between entity_pilot and the entity_reference_revisions module.
0 stars 2 forks source link

Changes in paragraphs are not getting imported to the site. #2

Open reshmaneerukonda opened 6 years ago

reshmaneerukonda commented 6 years ago

Background: Changes made to paragraphs in author site are not getting published to preview site.

Changes in the paragraph are not getting imported to the site. The first time, with the new database on the site the import of paragraphs work. Next time when we try to import the paragraphs from a manifest file containing paragraph json file, they are not imported to the site. No errors are thrown.

Modules used : entity_pilot, entity_pilot_git and entity_pilot_err

Could you please shed light on this entity_pilot_err module and can this be converted as a patch for entity_pilot.

acbramley commented 6 years ago

This module is designed as a bridge between entity_pilot and entity_reference_revisions (the module which provides the field types for paragraphs). It doesn't belong in the entity_pilot module as it is specific to the err module.

This module exports and imports paragraphs via uuids, can you provide some more information and a small sample manifest to test with? Have you tried debugging into the ParagraphNormalizer::denormalize function to see what is going wrong?

reshmaneerukonda commented 6 years ago

Thanks for the quick response. Attached the paragraph json extract. The first file containing the initial paragraph and the second file containing the changes paragraph_first.txt paragraph_second_withchanges.txt

I am debugging ParagraphNormalizer::denormalize function. I will let you know the results.

acbramley commented 6 years ago

Did the new manifest also contain the paragraph uuid? The files look fine to me, they contain the same uuids for the parent too.

reshmaneerukonda commented 6 years ago

"paragraph": { "transaction_tab_content": [ "1b35582b-a601-439b-9d82-18912605e362" ], "transaction_introduction_tabs": [ "7f393b06-86b2-4b3c-a6e9-0a2405da4a98" ] },

The paragraph uuid are contained in the manifest.

reshmaneerukonda commented 6 years ago

In ParagraphNormalizer::denormalize, the $data['parent_id'][$key]['value'] is not getting set for the first time. It is not going into any of the if statetments if ($entity = $this->unsavedUuid->resolve($this->uuidReference, $uuid, $entity_type_id)) nor if ($entity = $this->entityManager->loadEntityByUuid($entity_type_id, $value['target_uuid'])) {

When importing the content second time, it is setting $data['parent_id'][$key]['value'] with correct entity->id();

reshmaneerukonda commented 6 years ago

Also, was thinking whether we need to add ParagraphDependencySubscriber implementing EventSubcriberInterface similar to BookDependencySubscriber class in entity_pilot.

acbramley commented 6 years ago

@reshmaneerukonda that sounds correct. The first time it will be importing it as a new entity. Those if statements are trying to find existing entities to overwrite. I'm not sure we need the event subscriber. When I wrote this module it worked without it so I'm not sure what has changed since in order for it to stop working. Is it broken for all paragraphs or just some?

reshmaneerukonda commented 6 years ago

@acbramley: It is broken for all paragraphs. It works for the first time with a fresh database. However, whenever it tries to import on the existing site with entity_pilot_import, any paragraph changes are not getting reflected on the site. No error is thrown.
As a workaround, we are trying to respin the preview site from code, everytime any changes are made to paragraph.

reshmaneerukonda commented 6 years ago

@acbramley: Finally got it working by making changes to paragraphs denormalize method and EntityPilotErrServiceProvider. Could you please provide access to this repository, so I can push these changes to a new branch (8.x-2.x)

acbramley commented 6 years ago

@reshmaneerukonda please fork the repository and provide a pull request so I can review it. Thanks!

reshmaneerukonda commented 6 years ago

@acbramley: This issue still exists. It is all related to revision ids of paragraphs. The first time, it works since there will be only one revision exits for paragraph item. The second time when I import the manifest, it is creating additional revisions and they are not getting mapped correctly.

In EntityReferenceRevisionItemNormalizer, constructValue method it is returning an entity which is having the initial value...(with old revision number). $entity = $this->entityResolver->resolve($this, $data, $target_type)

acbramley commented 6 years ago

@reshmaneerukonda I understand, but you'll need to create a pull request in order for me to review your code changes and merge them into the repository. Please follow https://gist.github.com/Chaser324/ce0505fbed06b947d962 to create a fork and pull request :)

reshmaneerukonda commented 6 years ago

@acbramley: It is now picking the correct revision item of a paragraph, however, the parent id is not getting set correctly during denormalization. Created a pull request: https://github.com/acbramley/entity_pilot_err/pull/3

amitsharmadoj commented 6 years ago

@acbramley I have taken over this issue from @reshmaneerukonda. I found out that when I imported content using Entity Pilot (structure->entity-pilot->arrivals), import worked fine and correct values appeared in the database (screenshot attached) but when I imported content using Enitity Pilot Git (running import-content.sh from command line), import didn't happen correctly and I could see why because of incorrect values in the database (screenshot attached). I am not sure why the incorrect value is being inserted in the 'field_tab_title_value' column of 3rd row. Any suggestions are appreciated.

Note: First row in the screenshots is a result of creation of paragraph and next 2 rows are result of import.

correct-database-values.png correct-database-values

incorrect-database-values.png incorrect-database-values