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
Figure out what's going wrong.
Fix it.
Expand test coverage to try with users, too.
- Reviews/refinements.
- RTBC.
Commit.
User interface changes
API changes
Data model changes
Release notes snippet
Comments
Comment #2
dwwTest and fix.
Comment #5
dww