- Issue created by @reece.oliver
Creating a field on a page which is an entity reference which points configuration of my contact form this causes some issues for content synchronizer. When exporting the node I can see that the added field is exported like so
"field_contact": [
{
"target_id": "feedback"
}
],
and then when you try importing the content export to a site you will receive the error below
#23 {main}. | user: anonymous | uri: http://<redacted>/ | referer:
TypeError: explode(): Argument #2 ($string) must be of type string, array given in /<redacted>/modules/content_synchronizer/src/Service/GlobalReferenceManager.php on line 144 #0 /<redacted>/modules/content_synchronizer/src/Service/GlobalReferenceManager.php(144): explode()
#1 /<redacted>/modules/content_synchronizer/src/Entity/ImportEntity.php(429): Drupal\content_synchronizer\Service\GlobalReferenceManager->getEntityTypeFromGid()
#2 /<redacted>/modules/content_synchronizer/src/Entity/ImportEntity.php(441): Drupal\content_synchronizer\Entity\ImportEntity->getEntityDataFromGid()
#3 /<redacted>modules/content_synchronizer/src/Plugin/content_synchronizer/type_processor/EntityReferenceFieldItemListProcessor.php(151): Drupal\content_synchronizer\Entity\ImportEntity->gidIsCurrentlyImporting()
#4 /<redacted>/modules/content_synchronizer/src/Processors/Entity/EntityProcessorBase.php(601): Drupal\content_synchronizer\Plugin\content_synchronizer\type_processor\EntityReferenceFieldItemListProcessor->initImportedEntity()
This is because on the import is calls initImportedEntity
for the plugin EntityReferenceFieldItemListProcessor
and then eventually ends up at the code block
public function getEntityTypeFromGid($gid) {
$entityTypeId = explode('.', $gid)[1];
return $entityTypeId;
}
Which obviously doesn't make sense as in the above export its not a gid. So I'm not sure if it the export process broken here and it should be exporting the contact form as well and adding the gid into that section of the export like it does for other things or its the import process thats broken and it should be using FieldItemListProcessor
to process the Import instead. This is currently a major blocker as its needed to sync config between dev and production sites so would be grateful for any advice and or input
Add an entity reference field to a node under thats located in the configuration category and then try the export/import process
Active
4.0
Code