Warning: foreach() Argument Must be of Type array|object, Null Given in SchemaDotOrgCorrespondingReferenceManager

Created on 2 December 2023, about 1 year ago
Updated 6 December 2023, about 1 year ago

Problem/Motivation

Not sure if this deserve a new issue post, but since updating to 1.0.0-alpha12 from 1.0.0-alpha10 I see this warning on any /admin/structure/types/manage/content_type/schemadotorg page:

Error message
Close
Warning: foreach() argument must be of type array|object, null given in Drupal\schemadotorg_cer\SchemaDotOrgCorrespondingReferenceManager->mappingDefaultsAlter() (line 51 of modules/contrib/schemadotorg/modules/schemadotorg_cer/src/SchemaDotOrgCorrespondingReferenceManager.php).
Drupal\schemadotorg_cer\SchemaDotOrgCorrespondingReferenceManager->mappingDefaultsAlter(Array, 'node', 'administrative_area', 'AdministrativeArea') (Line: 20)
schemadotorg_cer_schemadotorg_mapping_defaults_alter(Array, 'node', 'administrative_area', 'AdministrativeArea') (Line: 114)
Drupal\schemadotorg\SchemaDotOrgMappingManager->Drupal\schemadotorg\{closure}(Object, 'schemadotorg_cer') (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('schemadotorg_mapping_defaults_alter', Object) (Line: 115)
Drupal\schemadotorg\SchemaDotOrgMappingManager->getMappingDefaults('node', 'administrative_area', 'AdministrativeArea') (Line: 405)
Drupal\schemadotorg_ui\Form\SchemaDotOrgUiMappingForm->buildFieldTypeForm(Array, Object) (Line: 184)
Drupal\schemadotorg_ui\Form\SchemaDotOrgUiMappingForm->form(Array, Object) (Line: 107)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('schemadotorg_mapping_edit_form', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 68)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 53)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

I understand the module is still in alpha release, but is there any other configuration setting to apply manually or is something else going wrong?

Thanks for pointing out how to solve that issue.

πŸ’¬ Support request
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

πŸ‡°πŸ‡¬Kyrgyzstan dan_metille

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @dan_metille
  • Status changed to Needs review about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    I added a section called 'Updating between alpha releases" to the project page β†’ .

    Please review this text. Recommendation and improvements are welcomed.

  • πŸ‡°πŸ‡¬Kyrgyzstan dan_metille

    Thanks for the clarity of the recommendations on the project page.

    Being more at ease with theming that development, it would be ideal to see a list of the updated config files on the release page. But, I understand all the great work being done for the development of schemadotorg and already more than happy with your support. Also, if I take better care of my configs files, I guess that I will be able now to smoothly manage the next updates.
    Big thanks!

  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    It is really hard to track all the config changes. For example, I recently removed all the configs from the JSON-LD and JSON:API previews.

    An MVP alpha-to-alpha update solution would be reimporting the default config from all modules. If we reimport all the config, the schemadotorg.schemadotorg_mapping.*.yml files will not be overwritten because they are new files.

    We could implement an update hook that is always triggered btw alpha-to-alpha, or we could create a drush schemadotorg-repair command which do reimport but requires developers and site builders to manually trigger the alpha-to-alpha repair.

    I will ask @FatherShawn to weigh in.

  • Status changed to Closed: works as designed about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States fathershawn New York

    The Config Update β†’ module is a great tool for this use case:

    The main use case is: You update a module, and it has either changed default config that it provides, or added new config items. You want to be able to import the new items, view the differences between the site config and the changed config, and possibly "revert" (or it may be an update) to the newly-provided default config.

    Given that we are in alpha state, I recommend using this tool to adjust configuration until we are in a more stable state.

  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    Another alternative is to use the Configuration Synchronizer module β†’ , which extends the Config Update module to provide methods for safely importing site configuration from updated modules, themes, or distributions.

Production build 0.71.5 2024