Warning: Undefined property: Drupal\external_entities\Entity\ExternalEntityType::$locks

Created on 21 August 2025, about 1 month ago

Problem/Motivation

Recent refactor commits (cd0e4af, f78b1c14) introduced a new locking mechanism for external entity types.
The config schema (external_entities.external_entity_type.*) already defines a rich locks mapping.
The ExternalEntityType class also has a getLocks() method that returns $this->locks.

However, the class is missing the $locks property declaration and "locks" in the config_export.
This leads to PHP notices/warnings when editing an external entity type:

Warning: Undefined property: Drupal\external_entities\Entity\ExternalEntityType::$locks in Drupal\external_entities\Entity\ExternalEntityType->getLocks() (line 1254 of modules/contrib/external_entities/src/Entity/ExternalEntityType.php).

Drupal\external_entities\Entity\ExternalEntityType->getLocks() (Line: 223)
Drupal\external_entities\Form\ExternalEntityTypeForm->form() (Line: 107)
Drupal\Core\Entity\EntityForm->buildForm()
call_user_func_array() (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 284)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult() (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 637)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

  1. Install the latest external_entities dev version.
  2. Create an external entity type.
  3. Edit it via /admin/structure/external-entity-types/{id}.
  4. Observe the PHP warning in the logs / UI.

Proposed resolution

/**
 * Locks configuration for this external entity type.
 *
 * @var array
 */
protected $locks = [];
  • Add "locks", to the @ConfigEntityType(config_export=…) list.
  • (Optional) Update getLocks() to return [] when unset, for robustnes
🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇩🇪Germany marcusx

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

Comments & Activities

Production build 0.71.5 2024