Problem/Motivation

We added \Drupal\dynamic_entity_reference\Normalizer\DynamicEntityReferenceItemNormalizer for hal in #2332117: Add a DynamicEntityReferenceItemNormalizer. We also need one for serialization module.

Proposed resolution

Add DynamicEntityReferenceItemNormalizer for serialization module

Remaining tasks

Create a patch wait #2827164: Entity reference field normalization has target_type and target_uuid, but not used in denormalization to get fixed.

User interface changes

None

API changes

DER will support plain json serialization.

Data model changes

None.

Comments

jibran created an issue. See original summary.

wim leers’s picture

a-fro’s picture

I'm running into issues with a project that's using Tome for static site generation. When calling drush tome:install everything works fine importing the content until it tries to generate serialized entities that are using dynamic entity reference. The error that gets thrown is

he command "/usr/local/bin/drush tome:import --yes --uri=default --root=/Users/aaron/sites/tome.test/web" failed.  
                                                                                                                      
  Exit Code: 1(General error)                                                                                         
                                                                                                                      
  Working directory:                                                                                                  
                                                                                                                      
  Output:                                                                                                             
  ================                                                                                                    
                                                                                                                      
   [ERROR] Errors encountered when importing content:                                                                 
                                                                                                                      
   [ERROR] Error when running "/usr/local/bin/drush tome:import-content                                               
           'collection_item.94b3123d-2019-4f6a-8a39-c758d8f3200f'":                                                   
                                                                                                                      
           In EntityReferenceFieldItemNormalizer.php line 83:                                                         
                                                                                                                      
                                                                                                                      
             The field "item" property "target_type" must be set to "" or omitted.     

I'll probably create an issue on the Tome project as well, but I think this might be related to the missing serialization normalizer for DER. Does that sound right? Any chance I could help pitch in to create the patch on this issue if so?

larowlan’s picture

Yes, this issue would need to be resolved. Please close the tome issue.