Problem/Motivation

If you install group and entitygroupfield, and configure the account form display to use a group widget before you create any group types and configure any group content plugins, you get an InvalidQueryException:

Drupal\Core\Database\InvalidQueryException: Query condition 'groups_field_data.type IN ()' cannot be empty. in Drupal\Core\Database\Query\Condition->condition() (line 105 of core/lib/Drupal/Core/Database/Query/Condition.php).
Drupal\Core\Database\Query\Select->condition('groups_field_data.type', Array, 'IN') (Line: 61)
Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 172)
Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 80)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 577)
Drupal\Core\Entity\EntityStorageBase->loadByProperties(Array) (Line: 49)
Drupal\entitygroupfield\Plugin\Field\FieldWidget\EntityGroupFieldSelectWidget->getPluginGroups() (Line: 64)
Drupal\entitygroupfield\Plugin\Field\FieldWidget\EntityGroupFieldSelectWidget->getAllowedGroups(, Array) (Line: 23)
Drupal\entitygroupfield\Plugin\Field\FieldWidget\EntityGroupFieldSelectWidget->buildAddElement(, Array) (Line: 753)
Drupal\entitygroupfield\Plugin\Field\FieldWidget\EntityGroupFieldWidgetBase->buildAddActions(, Array) (Line: 686)
Drupal\entitygroupfield\Plugin\Field\FieldWidget\EntityGroupFieldWidgetBase->formMultipleElements(Object, Array, Object) (Line: 113)
Drupal\Core\Field\WidgetBase->form(Object, Array, Object) (Line: 178)
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object, Array, Object) (Line: 125)
Drupal\Core\Entity\ContentEntityForm->form(Array, Object, Object) (Line: 304)
Drupal\user\AccountForm->form(Array, Object, Object) (Line: 54)
Drupal\user\RegisterForm->form(Array, Object) (Line: 149)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 532)
Drupal\Core\Form\FormBuilder->retrieveForm('user_register_form', Object) (Line: 278)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 91)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
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: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

It should work for group_membership + user, but it doesn't.

Proposed resolution

Find and fix bug.

Remaining tasks

  1. Figure out what's going wrong.
  2. Fix it.
  3. Expand test coverage to try with users, too.
  4. Reviews/refinements.
  5. RTBC.
  6. Commit.

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#2 3156276-2.with-fix.patch7.31 KBdww
#2 3156276-2.test-only.patch6.58 KBdww

Comments

dww created an issue. See original summary.

dww’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new6.58 KB
new7.31 KB

Test and fix.

The last submitted patch, 2: 3156276-2.test-only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • dww committed 13a94e9 on 1.0.x
    Issue #3156276 by dww: InvalidQueryException when dealing with user...
dww’s picture

Issue summary: View changes
Status: Needs review » Fixed

  • dww committed e53492c on 1.0.x
    Issue #3156276 by dww: Follow-up code style fix.
    

Status: Fixed » Closed (fixed)

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