apigee-edge-drupal icon indicating copy to clipboard operation
apigee-edge-drupal copied to clipboard

Unable to add multivalue entity reference field to developer apps

Open mxr576 opened this issue 1 year ago • 4 comments

Description

Probably other Apigee entity types are also affected based on the stack trace.

Apigee Info

N/A

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to /admin/config/apigee-edge/app-settings/developer-apps/fields click on Create a new field
  2. Add a new Reference -> Taxonomy term field to the entity with cardinality >= 1 (preferable choice: unlimited)
  3. Go to the developer app create form and try to save an app entity with multiple terms selected

Actual Behavior

The website encountered an unexpected error. Please try again later.

InvalidArgumentException: Value is not a valid entity. in Drupal\Core\Entity\Plugin\DataType\EntityReference->setValue() (line 106 of core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php).

Drupal\Core\TypedData\Plugin\DataType\Map->setValue() (Line: 125)
Drupal\Core\Field\FieldItemBase->setValue() (Line: 236)
Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem->setValue() (Line: 208)
Drupal\Core\TypedData\TypedDataManager->getPropertyInstance() (Line: 82)
Drupal\Core\Field\FieldTypePluginManager->createFieldItem() (Line: 41)
Drupal\Core\Field\FieldItemList->createItem() (Line: 69)
Drupal\Core\TypedData\Plugin\DataType\ItemList->setValue() (Line: 107)
Drupal\Core\Field\FieldItemList->setValue() (Line: 208)
Drupal\Core\TypedData\TypedDataManager->getPropertyInstance() (Line: 74)
Drupal\Core\Field\FieldTypePluginManager->createFieldItemList() (Line: 91)
Drupal\apigee_edge\Entity\AttributesAwareFieldableEdgeEntityBase->get() (Line: 395)
Drupal\apigee_edge\Entity\App->get() (Line: 333)
Drupal\apigee_edge\Entity\FieldableEdgeEntityBase->getFields() (Line: 536)
Drupal\apigee_edge\Entity\FieldableEdgeEntityBase->getIterator() (Line: 235)
Drupal\Core\Entity\Entity\EntityFormDisplay->extractFormValues() (Line: 168)
Drupal\apigee_edge\Entity\Form\FieldableEdgeEntityForm->copyFormValuesToEntity() (Line: 301)
Drupal\Core\Entity\EntityForm->buildEntity() (Line: 123)
Drupal\apigee_edge\Entity\Form\AppForm->buildEntity() (Line: 73)
Drupal\apigee_edge\Entity\Form\FieldableEdgeEntityForm->validateForm()
call_user_func_array() (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers() (Line: 275)
Drupal\Core\Form\FormValidator->doValidateForm() (Line: 118)
Drupal\Core\Form\FormValidator->validateForm() (Line: 593)
Drupal\Core\Form\FormBuilder->processForm() (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 583)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Please notice all Drupal\apigee_edge\ references in the stack trace that relate to the Apigee entity's fieldable entity roots.

Expected Behavior

The field content is saved to Apigee as an attribute.

Screenshots

Notes

Version Info

3.0.1

mxr576 avatar Sep 08 '23 13:09 mxr576

@mxr576 We tried the above mentioned 3 steps however we are not able to reproduce this issue on both 3.0.0 and 3.0.1. Is there anything we have missed?

shishir-intelli avatar Sep 11 '23 10:09 shishir-intelli

(Showcased on a screen share, please let me know if there is still an issue with reproducing it.)

mxr576 avatar Sep 13 '23 13:09 mxr576

Thanks @mxr576 I was able to reproduce this issue only when I check the Create referenced entities if they don't already exist checkbox in reference type setting. Screenshot 2023-09-13 at 7 18 18 PM

Not sure though what the exact issue is. We will check and work on it.

shishir-intelli avatar Sep 13 '23 13:09 shishir-intelli

I have a gut feeling that this is related to #948.

boobaa avatar Oct 12 '23 16:10 boobaa