apigee / apigee-edge-drupal

The Apigee Edge module enables you to integrate a Drupal 9 or 8 site with Apigee.
https://www.drupal.org/project/apigee_edge
GNU General Public License v2.0
32 stars 44 forks source link

Unable to add multivalue entity reference field to developer apps #930

Open mxr576 opened 1 year ago

mxr576 commented 1 year ago

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

shishir-intelli commented 1 year ago

@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?

mxr576 commented 1 year ago

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

shishir-intelli commented 1 year ago

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.

boobaa commented 1 year ago

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