There is an error when trying to delete any entity:
The website encountered an unexpected error. Please try again later.
Error: Call to a member function getColumns() on boolean in Drupal\Core\Entity\Query\Sql\Tables->addField() (line 168 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).
Drupal\Core\Entity\Query\Sql\Tables->addField('endpoints.entity_type', 'INNER', NULL) (Line: 44)
Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 39)
Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 162)
Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 81)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 431)
relation_entity_delete(Object)
call_user_func_array('relation_entity_delete', Array) (Line: 402)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_delete', Array) (Line: 169)
Drupal\Core\Entity\EntityStorageBase->invokeHook('delete', Object) (Line: 418)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('delete', Object) (Line: 369)
Drupal\Core\Entity\EntityStorageBase->delete(Array) (Line: 692)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->delete(Array) (Line: 366)
Drupal\Core\Entity\Entity->delete() (Line: 70)
Drupal\Core\Entity\ContentEntityDeleteForm->submitForm(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: 583)
Drupal\Core\Form\FormBuilder->processForm('node_page_delete_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('node_page_delete_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 572)
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}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 98)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 77)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 626)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Also, in code, $relation->endpoints returns NULL, so I think the problem is something about endpoints field.
Comment | File | Size | Author |
---|---|---|---|
#14 | interdiff-2704047-14.txt | 2.18 KB | sanja_m |
#14 | 2704047-14.patch | 5.79 KB | sanja_m |
#14 | 2704047-14-test-only.patch | 2.71 KB | sanja_m |
Comments
Comment #2
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedTested this and wasn't able to reproduce. Here is what I did:
1. Created relation type that references any node
2. Created 2 nodes
3. Created relation between them
Relation::create(['relation_type' => 'test', 'endpoints' => [['entity_type' => 'node', 'entity_id' => 1, 'r_index' => 0], ['entity_type' => 'node', 'entity_id' => 2, 'r_index' => 1]]])
4. Made sure relation appears in /admin/content/relation
5. Deleted relation
$relation->delete()
6. Made sure no fatal was thrown.
7. Made sure relation disappeared from /admin/content/relation
Could you provide steps that brought you to that error?
Comment #3
sanja_m CreditAttribution: sanja_m at MD Systems GmbH commentedSteps to reproduce:
1. Enable relation module
2. Do not create any relation type or relation
3. Try to delete any node - error appears, but the node has been deleted.
Added a quick patch that solves this.
And for the $relation->endpoints returning NULL still need to check, it's probably a bug in an issue where I detected this entity deletion problem - #2694321: Convert action_info functions to action plugins.
Comment #6
sanja_m CreditAttribution: sanja_m at MD Systems GmbH commentedRe-rolled patch from #3.
Comment #7
CTaPByK CreditAttribution: CTaPByK at MD Systems GmbH commentedCode look ok, just simple check if we have any relation. Patch is definitely help with this error.
Comment #8
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedI would rather check if there are any relation types defined (as this is actually the problem).
We also need test for this.
Comment #9
sanja_m CreditAttribution: sanja_m at MD Systems GmbH commentedAdded test coverage and left check for relations instead for relation types, because when deleting relation types (when there are no relations) error appears again.
Comment #12
CTaPByK CreditAttribution: CTaPByK at MD Systems GmbH commentedThis test looks ok, patch also. You should upload test-only patch first to avoid needs work status.
Comment #13
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedLet's use count query then.
Comment #14
sanja_m CreditAttribution: sanja_m at MD Systems GmbH commentedAdded count query and fixed some bugs in test after #2697931: Clean-up RelationType entity class.
Comment #17
CTaPByK CreditAttribution: CTaPByK at MD Systems GmbH commentedRTBC
Comment #19
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedCommitted.