It happens on any group type. I select create groups from the user permissions, and this it what i get when i go to group/add/examplegroup
Drupal\Core\Database\InvalidQueryException: Query condition 'group_content_field_data.gid IN ()' cannot be empty. in Drupal\Core\Database\Query\Condition->condition() (line 71 of core/lib/Drupal/Core/Database/Query/Condition.php).
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | 2017-04-04_14h43_56.png | 67.37 KB | maxilein |
Comments
Comment #2
kristiaanvandeneyndeCan you reproduce this with beta2?
Comment #3
kristiaanvandeneyndeComment #4
thronedigital commentedSorry i had to move on from this issue temporarily. I've narrowed to down to my bootstrap theme. The Group modules works as intended when switching to a different theme. My theme: Bootstrap 8.x-3.0-rc2 subtheme
Comment #5
thronedigital commentedComment #6
kristiaanvandeneyndeOkay so then forgive me for assuming the problem is in either Bootstrap or your subtheme's code. Could you XDebug your way through the error to see where it is coming from?
Comment #7
markhalliwellThis must be a Group issue per the warning:
group_content_field_data.gid IN ()' cannot be empty.The Bootstrap base theme does not intercept or modify module DB queries.
Indicating that it works in one theme but not another is not sufficient enough of a "test" to blame any theme.
That being said, this sounds more like a byproduct of the [lack] of a
_theme: ajax_base_pagerouter option, which was ultimately resolve by #2745953: AjaxBasePageNegotiator should not require _theme: ajax_base_page to be specified.Comment #8
kristiaanvandeneyndeThanks for clearing that up Mark!
@thronedigital Can you confirm this issue is resolved when using Drupal 8.2.0?
Comment #9
thronedigital commentedStatus update. I upgraded to 8.2 and am still receiving the same error on a bootstrap theme with authenticated user. I am currently able to bypass by switching to adminstration theme to Seven or Adminimal themes. This error is also produced in theme Bartik 8.2.1.
Another item to note is users with the role of Administrator work fine on all themes bootstrap included, it is only authenticated user that gets affected.
When you switch to theme Seven or Adminimal authenticated user works, so that is very strange.
Comment #10
kristiaanvandeneyndeRight, let's accept this as a bug then, seeing as it occurs in Bartik.
Comment #11
kristiaanvandeneyndeComment #12
markhalliwellNot caused by a theme
Comment #13
kristiaanvandeneyndeThat may be so, I changed the title to indicate it doesn't occur in all themes.
Comment #14
markhalliwellSure, I get that. I just took it a step further by removing the specific theme names. It made it appear as if it was an issue caused by both Bartik and Bootstrap code rather than simply appearing in both. There are many times when themes are simply innocent bystanders to issues that need fixing deeper in the system, hence my comment in #7. Surprised that the core bug fix didn't also remedy this one. Was pretty sure that's what the issue was.
Comment #15
kristiaanvandeneyndeI've tried to reproduce this with Drupal 8.2.2 and failed. Can you confirm that it is fixed with that version of core?
Comment #16
dafederI'm seeing this issue in a bootstrap subtheme but not when switching to bootstrap itself as my main theme. Drupal 8.2.5. Still debugging, will update!
Comment #17
dafederAlso, it is NOT occurring for me in Bartik.
Comment #18
kristiaanvandeneyndeHave you found anything new yet as to what makes this error happen?
Comment #19
maxilein commentedI'd like to add that this error is triggered when using Automatic Entity Label
D8.2.7
Group 8.x-1.0-beta5
and Automatic Entity Label latest dev which corresponds to 8.x-2.0-beta1.
As I have also reported here, because I think it is connected to token support, too: https://www.drupal.org/node/2774827#comment-12021840
Creating a node using https://www.drupal.org/project/auto_entitylabel
[node:group:id] [node:group:label]
Causes 2 errors:
Drupal\Core\Database\InvalidQueryException: Query condition 'group_content_field_data.entity_id IN ()' cannot be empty. in Drupal\Core\Database\Query\Condition->condition() (line 71 of /../core/lib/Drupal/Core/Database/Query/Condition.php).
Drupal\Core\Entity\EntityStorageException: Query condition 'group_content_field_data.entity_id IN ()' cannot be empty. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 770 of /../core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Comment #20
kristiaanvandeneyndeThe problem with the errors reported here is that something is triggering the retrieval of GroupContent entities by the entities they represent (entity_id base field), without specifying what IDs to filter on. Seeing as this occurs in various weird situations that cannot be easily reproduced, I doubt that it has anything to do with auto_entitylabel.
Unless someone has steps to reproduce this issue without failure, we cannot fix this. So please either:
Comment #21
maxilein commentedI enabled "All messages, with backtrace information" under logging.
Hope that helps. XDebug would take more time ... let me know.
Tried to create a projekt - node under /group/4/content/create/group_node%3Aprojekt
Drupal\Core\Database\Query\Select->condition('group_content_field_data.entity_id', Array, 'IN') (Line: 53)
Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 155)
Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 74)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 503)
Drupal\Core\Entity\EntityStorageBase->loadByProperties(Array) (Line: 135)
Drupal\group\Entity\GroupContent::loadByEntity(Object) (Line: 55)
gnode_tokens('node', Array, Array, Array, Object)
call_user_func_array('gnode_tokens', Array) (Line: 402)
Drupal\Core\Extension\ModuleHandler->invokeAll('tokens', Array) (Line: 304)
Drupal\Core\Utility\Token->generate('node', Array, Array, Array, Object) (Line: 196)
Drupal\Core\Utility\Token->replace('[node:content-type]:p[node:nid]', Array, Array) (Line: 237)
Drupal\auto_entitylabel\AutoEntityLabelManager->generateLabel('[node:content-type]:p[node:nid]', Object) (Line: 137)
Drupal\auto_entitylabel\AutoEntityLabelManager->setLabel() (Line: 106)
auto_entitylabel_entity_presave(Object)
call_user_func_array('auto_entitylabel_entity_presave', Array) (Line: 402)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_presave', Array) (Line: 169)
Drupal\Core\Entity\EntityStorageBase->invokeHook('presave', Object) (Line: 418)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('presave', Object) (Line: 435)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 291)
Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object) (Line: 389)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 761)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 364)
Drupal\Core\Entity\Entity->save() (Line: 368)
Drupal\node\NodeForm->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: 585)
Drupal\Core\Form\FormBuilder->processForm('node_projekt_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('node_projekt_form', Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'default', Array) (Line: 351)
Drupal\group\Entity\Controller\GroupContentController->createForm(Object, 'group_node:projekt')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
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: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
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: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
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: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comment #22
maxilein commentedYou should be able to reproduce this by using the automatic entity label:
The error appears once it is enabled on a node type and goes away once it is disabled.
Comment #23
kristiaanvandeneyndeIn your case, it's the patch in the other issue that's broken. It tries to load GroupContent entities for an entity that hasn't been saved yet. Maybe we can/should fix this in Group to prevent people from making the same mistake.
Comment #24
maxilein commentedWow, you are really fast!
And I have to mention: Group is THE ONE module that has been terribly missing in Drupal for years! Thanks for building it!