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.
Comment | File | Size | Author |
---|---|---|---|
#9 | interdiff-3066452-8-9.txt | 2.35 KB | tetranz |
#9 | eck-apply-entity-updates-3066452-9.patch | 15.59 KB | tetranz |
| |||
#8 | interdiff-3066452-7-8.txt | 432 bytes | tetranz |
#8 | eck-apply-entity-updates-3066452-8.patch | 15.27 KB | tetranz |
| |||
#7 | interdiff-3066452-6-7.txt | 1.24 KB | tetranz |
Comments
Comment #2
handkerchief+1 - Same problem here.
Comment #3
jennypanighetti CreditAttribution: jennypanighetti commentedSame here!
Comment #4
jennypanighetti CreditAttribution: jennypanighetti commentedIt is this portion of the code (see screenshot) in eck/src/Entity/EckEntityType.php
Comment #5
tetranz CreditAttribution: tetranz at Third and Grove commentedHere'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.
Comment #6
tetranz CreditAttribution: tetranz at Third and Grove commentedFixes 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.
Comment #7
tetranz CreditAttribution: tetranz at Third and Grove commentedThis 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.
Comment #8
tetranz CreditAttribution: tetranz at Third and Grove commentedThis gets all tests passing.
Comment #9
tetranz CreditAttribution: tetranz at Third and Grove commentedCoding standards.
I'm not sure about the "only string literal" in t() for the label.
Comment #10
sim_1Manually 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.
Comment #11
pifagorComment #13
pifagor