On a fresh Drupal install core 8.7.4, with Content Translation enabled, after saving a new Entity I'm getting the following error:

User deprecated function: EntityDefinitionUpdateManagerInterface::applyUpdates() is deprecated in 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Entity\EntityDefinitionUpdateManagerInterface::getChangeList() and execute each entity type and field storage update manually instead. See https://www.drupal.org/node/3034742. in Drupal\Core\Entity\EntityDefinitionUpdateManager->applyUpdates() (line 175 of core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php).
Drupal\Core\Entity\EntityDefinitionUpdateManager->applyUpdates() (Line: 121)
Drupal\eck\Entity\EckEntityType->postSave(Object, ) (Line: 526)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, ) (Line: 452)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 263)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 394)
Drupal\Core\Entity\EntityBase->save() (Line: 613)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 137)
Drupal\eck\Form\EntityType\EckEntityTypeFormBase->save(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 590)
Drupal\Core\Form\FormBuilder->processForm('eck_entity_type_add_form', Array, Object) (Line: 319)
Drupal\Core\Form\FormBuilder->buildForm('eck_entity_type_add_form', Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
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: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
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: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to replicate:

1) Add Entity type, /admin/structure/eck
2) Just select Title as option.
3) Save.

The Entity type gets created and fields can be added as normal.

Not sure if the issue has something to do with this bug https://www.drupal.org/project/eck/issues/3055007 since on a fresh Drupal install and using composer to get the module, i don't see other errors but the one described above.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andres.torres created an issue. See original summary.

handkerchief’s picture

+1 - Same problem here.

jennypanighetti’s picture

Same here!

jennypanighetti’s picture

It is this portion of the code (see screenshot) in eck/src/Entity/EckEntityType.php

tetranz’s picture

Here's a possible solution. I copied most of the code from the devel_entity_updates module which is basically what applyUpdates() used to do. I think I understand why applyUpdates was removed but I think this is doing it in a responsible way. It's only doing it for the one content entity being edited and its corresponding bundle _type config entity.

I think using the EntityDefinitionUpdateManager::getChanges() rather than trying to figure out what the form just changed will make it somewhat self healing if something goes wrong.

If this is not fixed, we have entities in an invalid state. applyUpdates() is more than just deprecated in Drupal 8.8. It now just triggers an error and does nothing else.

A simple adhoc test is to create entities, make some changes etc then look in /admin/reports/status to see if there are any entity/field definition errors reported.

tetranz’s picture

Fixes some deprecations. This gets the EntityTypeCRUDTest test passing which it wasn't before with Drupal 8.8.

I think we need a general "Fix deprecated code" issue.

I'll try to do some more tomorrow.

tetranz’s picture

This gets the BundleCRUDTest passing.

I hope this is useful. I'm running the tests in the admin UI on Drupal 8.8. Most are failing either because of deprecations or more strict checking in various places.

Since this issue is about deprecations, it seems easiest to continue adding to this patch. I will continue unless someone thinks this is a bad idea.

tetranz’s picture

This gets all tests passing.

tetranz’s picture

Coding standards.

I'm not sure about the "only string literal" in t() for the label.

sim_1’s picture

Status: Needs review » Reviewed & tested by the community

Manually tested on Drupal 8.8.x-dev with the latest eck-1.x-dev.

Without the patch I was able to recreate the issue. With the patch the issue was resolved.

Marking as RTBC unless other ppl have an objection.

pifagor’s picture

  • pifagor committed 959734b on 8.x-1.x authored by tetranz
    Issue #3066452 by tetranz, andres.torres, jennypanighetti, sim_1,...
pifagor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.