Support from Acquia helps fund testing for Drupal Acquia logo

Comments

msankhala created an issue. See original summary.

msankhala’s picture

Now i can't access admin/structure/eck/entity_type anymore. It show website encountered an error message.

mogio_hh’s picture

Same Here.. this is a mature mature bug.

darvanen’s picture

I can't reproduce this error, can you post steps to follow on a fresh site?

msankhala’s picture

@Darvanen I tried with version 8.x-1.0-alpha3. Here are the steps:
1. Create two entities let say Meal and Attendance
2. Add bundle to each of these entities with same name. meal bundle on Meal entity and attendance bundle on Attendance entity.
3. Add couple of fields to both of these bundle.
4. Now try to delete attendance entity.

You should get the error which i provided in description.

Matroskeen’s picture

Issue tags: +LutskGSW18
heyitspython’s picture

I'm also having this issue. Module version: Version: 8.x-1.0-alpha3, Drupal core version: 8.5.1

1. I created an entity and entity bundle both named "in-person location."
2. I added this to a paragraph "required in-person visit" and to another bundle "in person"
3. I deleted the in-person location entity.
4. White screen message "unexpected error."
5. This error displays when I click on ECK under structure now as well.

There are 3 log messages for this event:

Type entity_reference
Date Thursday, April 5, 2018 - 19:34
User admin
Location https://default/admin/structure/eck/entity_type/manage/in_person_locatio...
Referrer https://default/admin/structure/eck/entity_type/manage/in_person_locatio...
Message The field_location entity reference field (entity_type: method, bundle: in_person) no longer has any valid bundle it can reference. The field is not working correctly anymore and has to be adjusted.
Severity Critical
Hostname
Operations

Type entity_reference
Date Thursday, April 5, 2018 - 19:35
User admin
Location https://defaul/admin/structure/eck/entity_type/manage/in_person_location...
Referrer https://default/admin/structure/eck/entity_type/manage/in_person_locatio...
Message The field_location entity reference field (entity_type: paragraph, bundle: _required_in_person_visit_step) no longer has any valid bundle it can reference. The field is not working correctly anymore and has to be adjusted.
Severity Critical
Hostname
Operations

Type php
Date Thursday, April 5, 2018 - 19:35
User admin
Location https://default/admin/structure/eck/entity_type/manage/in_person_locatio...
Referrer https://default/admin/structure/eck/entity_type/manage/in_person_locatio...
Message Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pantheon.in_person_location__abaee0cc1f' doesn't exist: SELECT 1 AS expression FROM {in_person_location__abaee0cc1f} t WHERE (field_instructions_for_arrival_value IS NOT NULL) OR (field_instructions_for_arrival_format IS NOT NULL) LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->countFieldData() (line 1735 of /app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Severity Error
Hostname
Operations

heyitspython’s picture

Issue summary: View changes

A new discovery– if you delete the bundle first, then the entity, this error does not occur at first! When you try to create new a new entity however, it brings the whole site into an unexpected error.

Jaesin’s picture

Adding a test only patch for the first test case in this issue.

When deleting an entity type that has a single bundle with the same name, the entity type is allowed to be deleted but causes an error.

Jaesin’s picture

Another UI test.

Jaesin’s picture

Test against the label instead of the machine name.

Jaesin’s picture

The way I see it, the issue is with the eck entity delete form:

<?php
    if (!empty($bundles) && empty($bundles[$this->entity->id()])) {
?>

I'm not sure why a bundle type with the same ID as the eck entity should be treated as a special case but either way this doesn't catch when there are multiple bundles and one matches the id of the entity.

That said, it's not really the issue. This only occurs when there is a bundle with a matching id and some bundle of the entity type has fields.

I created a test that reproduces the 500 error.

Jaesin’s picture

For the entity delete form, I added a check for actual content. I think it's best to let the parent (core) entity delete form handle the deletion and deal with configuration dependencies no matter how many bundles there are or what their ids are.

Jaesin’s picture

The previous patch (`do_eck_2901134_13_test-only.patch`) has the fix despite it being named test-only.

Jaesin’s picture

Same patch just renamed. No interdiff.

Jaesin’s picture

Status: Active » Needs review

Status: Needs review » Needs work

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

dqd’s picture

Start testing ... (ps: shouldn't we patch against latest dev?)

Jaesin’s picture

Status: Needs work » Needs review

The patch applies to the 8.x-1.x branch.

DamienMcKenna’s picture

Version: 8.x-1.0-alpha3 » 8.x-1.x-dev
Issue tags: +Needs tests

I think some tests would be useful.

DamienMcKenna’s picture

Issue tags: -eck
Jaesin’s picture

There are tests in the patch. See: do_eck_2901134_15.patch. Let me know if you think something is missing.

DamienMcKenna’s picture

Issue tags: -Needs tests

Apologies, you are correct.

Status: Needs review » Needs work

The last submitted patch, 15: do_eck_2901134_15.patch, failed testing. View results

rshafakian’s picture

Status: Needs work » Needs review
FileSize
11.23 KB

Tests resulted in message "PHP 7 & MySQL 5.5, D8.7 Patch Failed to Apply" Seemed to happen after the tests were corrected. Uploading the new diff file based on the newest code.

legolasbo’s picture

The patch looks good except for some nitpicks, which I've addressed in this patch. I'll commit this if the patch comes back green.

  • legolasbo committed 92478b5 on 8.x-1.x authored by Jaesin
    Issue #2901134 by Jaesin, legolasbo, rshafakian: Can not delete entity...
legolasbo’s picture

Status: Needs review » Fixed

Committed and pushed to 8.x-1.x. Thanks for your contribution!

msankhala’s picture

Isn't it a good idea to give credit someone for creating an issue?

legolasbo’s picture

Good point @msankhala,

I'll take issue creation into consideration next time :)

Status: Fixed » Closed (fixed)

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