Deprecation error in DOComputedFields

Created on 18 October 2023, about 1 year ago
Updated 5 September 2024, 4 months ago

Problem/Motivation

The module throws this error on a site.

Deprecated function: Creation of dynamic property Drupal\do_username\DOComputedFields::$doUserService is deprecated in Drupal\do_username\DOComputedFields->__construct() (line 22 of modules/contrib/do_username/src/DOComputedFields.php).
Drupal\do_username\DOComputedFields->__construct(Object, 'bio', Object) (Line: 47)
Drupal\Core\TypedData\TypedData::createInstance(Object, 'bio', Object) (Line: 91)
Drupal\Core\TypedData\TypedDataManager->createInstance('string', Array) (Line: 100)
Drupal\Core\TypedData\TypedDataManager->create(Object, NULL, 'bio', Object) (Line: 200)
Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object, 'bio') (Line: 66)
Drupal\Core\Field\FieldItemBase->__construct(Object, 'bio', Object) (Line: 47)
Drupal\Core\TypedData\TypedData::createInstance(Object, 0, Object) (Line: 91)
Drupal\Core\TypedData\TypedDataManager->createInstance('field_item:do_username', Array) (Line: 100)
Drupal\Core\TypedData\TypedDataManager->create(Object, NULL, 0, Object) (Line: 200)
Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object, 0, Array) (Line: 82)
Drupal\Core\Field\FieldTypePluginManager->createFieldItem(Object, 0, Array) (Line: 41)
Drupal\Core\Field\FieldItemList->createItem(0, Array) (Line: 69)
Drupal\Core\TypedData\Plugin\DataType\ItemList->setValue(Array, ) (Line: 107)
Drupal\Core\Field\FieldItemList->setValue(Array, ) (Line: 208)
Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object, 'field_do_username', Array) (Line: 74)
Drupal\Core\Field\FieldTypePluginManager->createFieldItemList(Object, 'field_do_username', Array) (Line: 600)
Drupal\Core\Entity\ContentEntityBase->getTranslatedField('field_do_username', 'x-default') (Line: 564)
Drupal\Core\Entity\ContentEntityBase->get('field_do_username') (Line: 181)
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object, Array, Object) (Line: 121)
Drupal\Core\Entity\ContentEntityForm->form(Array, Object) (Line: 311)
Drupal\user\AccountForm->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('user_form', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->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: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 182)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->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)

Steps to reproduce

Just install the module and view a form where this field is present. This might also show up on other pages randomly (errors shown from session).

Proposed resolution

It's an easy enough fix. Define the property in the class as indicated by the error message.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇨🇦Canada hussainweb

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024