apigee-edge-drupal
apigee-edge-drupal copied to clipboard
Add magic get/setters for entityreferences (#948)
Closes #948.
Thank you @boobaa for your contribution. We will review the PR and update.
Also had to distinguish apigee baseFields: without doing that, /teams
page was just a WSOD.
Hi @boobaa I have checked the commits and files on the new installation. Before implementing the fix, as per @mxr576 steps to reproduce, the issue is WSOD Post applying the changes, we still see the WSOD following the same steps.
We cannot merge this as it does not solves the mentioned issue. It will need more further work and testing.
Thanks!
Hi @boobaa We have performed the following tests to check the fix post appending your changes.
- Created a new API reference field in Teams creation form.
- Checked the create new entity if not avaiable option in the field settings page.
- Created a Team with new text in the entity reference field and submitted the team.
- WSOD was observed.
This led to the failure of manual test from my end. If there is any specific steps you tried to check the working state of code which gave you positive results please share with us, we will surely look into it.
Thanks!
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
dc96b7d
) 44.20% compared to head (b67f189
) 44.20%.
Additional details and impacted files
@@ Coverage Diff @@
## 3.x #956 +/- ##
=========================================
Coverage 44.20% 44.20%
Complexity 3029 3029
=========================================
Files 341 341
Lines 11086 11086
=========================================
Hits 4901 4901
Misses 6185 6185
Files | Coverage Δ | |
---|---|---|
src/Entity/FieldableEdgeEntityBase.php | 76.58% <ø> (ø) |
Here's what I did for reproduction:
- Installed drupal-10.2.1 from scratch, with minimal profile + field_ui module.
- Installed drupal/apigee_edge-3.0.5 and configured it to use an organization on our OPDK server. Connection was successful.
- Navigated to
/admin/config/apigee-edge/team-settings/fields
and created a new Reference field for an API (product). - Navigated to
/admin/structure/block
and placed the "Team switcher" block. - Navigated to an already-existing team using this "Team switcher" block.
- Clicked Edit, typed an already-existing API (product) name to the just added field.
- Clicked "Save team".
Expected result: team getting saved properly, with the new field being displayed with the selected API (product).
Actual result without the patch: WSOD (The website encountered an unexpected error. Try again later.
), with this in the logs:
Error: Call to a member function getValue() on null in Drupal\Core\Entity\Plugin\Validation\Constraint\ValidReferenceConstraintValidator->validate() (line 128 of /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ValidReferenceConstraintValidator.php).
Actual result with the patch: team got saved properly, with the new field displaying the selected API (product).
FTR, I ran composer require cweagans/composer-patches
and added this to the extra
section of my root composer.json to apply the patch:
"patches": {
"drupal/apigee_edge": {
"Magic getters/setters support for fieldable Apigee entities - https://github.com/apigee/apigee-edge-drupal/pull/956": "https://patch-diff.githubusercontent.com/raw/apigee/apigee-edge-drupal/pull/956.patch"
}
}
Hope this helps.
Hi @boobaa
Drupal version - 10.1.8 & 10.2.2 Apigee Edge 3.0.5 checked with Devportal latest version as well as on the Vanilla Drupal 10.2.2 version. As per the steps you shared we checked and just wanted to clear few points.
- On point 3, when you are creating a new Reference field for an API, are you selecting this checkbox - Create referenced entities if they don't already exist
- If yes, then on point 6, are you trying to create a new value in API reference field ?
The steps which you mentioned, in that case, we do not see any error/WSOD on the page without applying any patch.
Issue occurs when the above 2 points are performed. Just to be on the same page, can you tell us, if the code was checked with these 2 points ?
Thanks!
Hi @kedarkhaire ,
as the customer does not want to litter their Apigee Edge with random API products when teams are getting created/edited, but only allow users to select from already-existing API products, those options are NOT enabled.