Site Crash after creating custom EntityReference field for Organizations
Overview
Today I managed to inadvertently take down the dmaster and d10-master CiviCRM demo sites by creating a custom field of DataType=EntityReference and Entity=Organizations.
Those sites were running CiviCRM version 5.67.alpha1.
Reproduction steps
- Create a new custom field, set Data Type = Entity Reference and Entity = Organizations.
- When you click Save, the site crashes.
Current behaviour
The error thrown after clicking save on this page: https://d10-master.demo.civicrm.org/civicrm/admin/custom/group/fields
The website encountered an unexpected error. Please try again later.
TypeError: CRM_Core_DAO_AllCoreTables::getTableForEntityName(): Return value must be of type string, null returned in CRM_Core_DAO_AllCoreTables::getTableForEntityName() (line 365 of /srv/buildkit/build/d10-master/vendor/civicrm/civicrm-core/CRM/Core/DAO/AllCoreTables.php).
Civi\Api4\Service\Schema\SchemaMapBuilder->addCustomFields() (Line: 73)
Civi\Api4\Service\Schema\SchemaMapBuilder->loadTables() (Line: 51)
Civi\Api4\Service\Schema\SchemaMapBuilder->build() (Line: 286)
Civi\Api4\Utils\CoreUtil::getSchemaMap() (Line: 772)
Civi\Api4\Query\Api4SelectQuery->autoJoinFK() (Line: 393)
Civi\Api4\Query\Api4SelectQuery->getField() (Line: 312)
Civi\Api4\Query\Api4SelectQuery->fillEntityValues() (Line: 83)
Civi\Api4\Query\Api4SelectQuery->__construct() (Line: 106)
Civi\Api4\Generic\DAOGetAction->getObjects() (Line: 94)
Civi\Api4\Generic\DAOGetAction->_run() (Line: 72)
Civi\Api4\Provider\ActionObjectProvider->invoke() (Line: 156)
Civi\API\Kernel->runRequest() (Line: 256)
Civi\Api4\Generic\AbstractAction->execute() (Line: 51)
Civi\Search\AfformSearchMetadataInjector::Civi\Search\{closure}()
call_user_func() (Line: 59)
Civi\Angular\ChangeSet::applyHtmlFilters() (Line: 19)
Civi\Angular\ChangeSet::applyResourceFilters() (Line: 295)
Civi\Angular\Manager->getPartials() (Line: 160)
Civi\Angular\Page\Modules->getMetadata() (Line: 82)
Civi\Angular\Page\Modules::buildAngularModules() (Line: 220)
Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)
Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 263)
Civi\Core\CiviEventDispatcher->dispatch() (Line: 168)
CRM_Utils_Hook->invoke() (Line: 2782)
CRM_Utils_Hook::buildAsset() (Line: 226)
Civi\Core\AssetBuilder->render() (Line: 198)
Civi\Core\AssetBuilder->build() (Line: 136)
Civi\Core\AssetBuilder->getUrl() (Line: 169)
Civi\Angular\AngularLoader->Civi\Angular\{closure}() (Line: 394)
CRM_Core_Region->getSettings() (Line: 142)
CRM_Core_Region->{closure}() (Line: 157)
CRM_Core_Region->render() (Line: 37)
civicrm_page_attachments() (Line: 311)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 312)
Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks() (Line: 285)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 286)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 187)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)
Expected behaviour
It should save the custom field and return to the list of fields in the custom field set.
Environment information
- CiviCRM: 5.67.alpha1