- Issue created by @natts
- πΊπΈUnited States pdxclankeith
Ran into the getName() null error on Drupal 10.2.5 after upgrading to 2.1.0-rc1.
- π³πΏNew Zealand ericgsmith
This is a regress from this issue π Unable to create extra field on user entity Fixed
That changes the ID of the config - but there is no update hook provided to fix existing config.
What is happening is that the the config storage loads all the configs which are keyed by the old id:
foreach ($this->configFactory->loadMultiple($names) as $config) { $id = $config->get($this->idKey); $records[$id] = $this->overrideFree ? $config->getOriginal(NULL, FALSE) : $config->get(); $configs[$id] = $config; } $entities = $this->mapFromStorageRecords($records);
When it loops through the entities returned, they have the key id, so this thows an exception as $configs[$id] isn't set - configs is keyed by the old id.
foreach ($entities as $id => $entity) { $self_referring_cache_tag = ['config:' . $configs[$id]->getName()];
This module needs an update hook to fix the old configs.
- Merge request !15Issue #3440365: Restore use of base entity type id as part of entity extra field id β (Open) created by ericgsmith
- π³πΏNew Zealand ericgsmith
Opened MR to revert the change which I believe is accidental.
This will still need an update hook I believe, as this will cause the same issue for people who have created config from 2.1.0-rc1 or when using the committed diff as a patch (as indicated in the related issue, some people are using the committed change already having updated the config ids themselves).
Setting needs work as I think with or without the id revert this will need an update hook to ensure what is in configuration matches what the entity generates for its id.
- Status changed to Needs work
7 months ago 4:35am 24 April 2024 - Status changed to Needs review
7 months ago 7:17am 25 April 2024 Hello,
After installing the module, the two errors are occurring, one is while creating a new extra field and another is when editing the existing extra field.
ERRORS:
1. Error: Typed property Drupal\entity_extra_field\Entity\EntityExtraField::$name must not be accessed before initialization
2. Error: Call to a member function getName() on nullSolution:
To resolve above two errors, created a patch. Please review the attached patch file.
Thank you!- π³πΏNew Zealand ericgsmith
Hi arora.shivani,
There is a different issue reported in π Unable to add an extra field on a content type/bundle that has no extra fields already Active which is specific to your first issue.
There is already a patch in that issue that is the same as yours so it looks like that is another valid fix that needs to go in but this issue is about existing data not fresh installs.
Please do follow up in that related issue that the patch works for you.
Setting back to needs work based on my previous comment / MR.
- Status changed to Needs work
7 months ago 8:50am 25 April 2024 - Status changed to Needs review
7 months ago 8:53am 25 April 2024 - π³πΏNew Zealand ericgsmith
@arora.shivani - I took a look and the patch doesn't do anything for the errors reported specifically in this issue - I think my original comment stands that your issue is likely in π Unable to add an extra field on a content type/bundle that has no extra fields already Active
Added an update hook to correct any broken config.
This I think can be used for either case if the id change is reverted or not.
It will help people who have either created config using the changed id format - or if the id format is not going to change back it will convert old config to the new format.
The new format is I think a mistake, if you have the same bundle name across multiple entity types (rare but possible) this could lead to collision, I believe it was just a mistake that can be reverted.
- Status changed to RTBC
6 months ago 5:23pm 28 May 2024 - π§πͺBelgium Vacilando Brussels
#11 worked for me as well. Could this please be committed to dev at least?
- First commit to issue fork.
- π©πͺGermany Grevil
Rebased the branch. Should be mergable again (Didn't take a look at the code though).
- π¬π§United Kingdom richard.lampitt
I'm still getting this error on a client site of ours with 2.1.0-rc3 on core 10.3.6:
Error: Call to a member function getName() on null in Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple() (line 206 of /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php).
#0 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityStorageBase.php(312): Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple(NULL) #1 /home/virtual-server-name/client-name/public_html/httpdocs/modules/contrib/entity_extra_field/entity_extra_field.module(26): Drupal\Core\Entity\EntityStorageBase->loadMultiple() #2 [internal function]: entity_extra_field_entity_extra_field_info() #3 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Extension/ModuleHandler.php(416): call_user_func_array(Object(Closure), Array) #4 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Extension/ModuleHandler.php(395): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object(Closure), 'entity_extra_fi...') #5 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Extension/ModuleHandler.php(423): Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_extra_fi...', Object(Closure)) #6 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityFieldManager.php(676): Drupal\Core\Extension\ModuleHandler->invokeAll('entity_extra_fi...') #7 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityFieldManager.php(649): Drupal\Core\Entity\EntityFieldManager->loadExtraFields() #8 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityDisplayBase.php(173): Drupal\Core\Entity\EntityFieldManager->getExtraFields('node', 'page') #9 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityDisplayBase.php(155): Drupal\Core\Entity\EntityDisplayBase->init() #10 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(181): Drupal\Core\Entity\EntityDisplayBase->__construct(Array, 'entity_view_dis...') #11 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityStorageBase.php(418): Drupal\Core\Entity\Entity\EntityViewDisplay->__construct(Array, 'entity_view_dis...') #12 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(186): Drupal\Core\Entity\EntityStorageBase->mapFromStorageRecords(Array) #13 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityStorageBase.php(312): Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple(Array) #14 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(121): Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) #15 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(281): Drupal\Core\Entity\Entity\EntityViewDisplay::collectRenderDisplays(Array, 'full') #16 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(239): Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) #17 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build(Array) #18 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array(Array, Array) #19 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_ren...', 'exception', 'Drupal\\Core\\Ren...') #20 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) #21 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender(Array, false) #22 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(238): Drupal\Core\Render\Renderer->render(Array, false) #23 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() #24 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(239): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #25 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch)) #26 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch)) #27 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #28 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #29 /home/virtual-server-name/client-name/public_html/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view') #30 /home/virtual-server-name/client-name/public_html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #31 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #32 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #33 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #34 /home/virtual-server-name/client-name/public_html/httpdocs/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #35 /home/virtual-server-name/client-name/public_html/httpdocs/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #36 /home/virtual-server-name/client-name/public_html/httpdocs/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true) #37 /home/virtual-server-name/client-name/public_html/httpdocs/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true) #38 /home/virtual-server-name/client-name/public_html/httpdocs/modules/contrib/cleantalk/src/EventSubscriber/BootSubscriber.php(206): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #39 /home/virtual-server-name/client-name/public_html/httpdocs/modules/contrib/shield/src/ShieldMiddleware.php(263): Drupal\cleantalk\EventSubscriber\BootSubscriber->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #40 /home/virtual-server-name/client-name/public_html/httpdocs/modules/contrib/shield/src/ShieldMiddleware.php(130): Drupal\shield\ShieldMiddleware->bypass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #41 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\shield\ShieldMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #42 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #43 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #44 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #45 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #46 /home/virtual-server-name/client-name/public_html/httpdocs/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #47 {main}