Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I tried ECK to see where it is dev wise on a 8.2.x site. I created one type, tried it out, deleted them then uninstalled the module. I instantly got this error:
Drupal\Component\Plugin\Exception\PluginNotFoundException";s:8:"@message";s:40:"The "two_up" entity type does not exist.";s:9:"%function";s:53:"Drupal\Core\Entity\EntityTypeManager->getDefinition()";s:5:"%file";s:66:"/var/www/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php";s:5:"%line";i:125;s:17:"@backtrace_string";s:5180:"#0 /var/www/docroot/core/lib/Drupal/Core/Entity/EntityManager.php(46): Drupal\Core\Entity\EntityTypeManager->getDefinition('two_up', true)
#1 /var/www/docroot/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php(115): Drupal\Core\Entity\EntityManager->getDefinition('two_up')
No matter how many times I clear the cache, or remove items from the database that should no longer exist, this error appears every single time I remove a field from any entity, even after ECK and this type have been removed.
Comment | File | Size | Author |
---|---|---|---|
#7 | cannot_cleanly-2796655-7.patch | 2.37 KB | legolasbo |
#7 | cannot_cleanly-2796655-7-test-only.patch | 1.74 KB | legolasbo |
Comments
Comment #2
legolasboAttached patches add a test that demonstrates this issue and a fix for it.
Comment #7
legolasboAdded missing @group annotation to get the test passing
Comment #11
legolasboComment #12
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commentedBrilliantly simple fix. I know the patch may need some changes to pass tests, but in practice it works for me to allow me to add and delete ECK types at will without causing the error anymore (so far at least).
Comment #13
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commentedSadly I ran into an error still trying to delete an entity type with this patch installed. I deleted it from the main ECK page, including its bundle (so I didn't delete the bundle first this time), and now every time I try and load the main ECK page or do much of anything on the site I get:
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pantheon.question' doesn't exist: SELECT base_table.id AS id, base_table.id AS base_table_id FROM {question} base_table GROUP BY base_table.id LIMIT 1 OFFSET 0; Array ( ) in Drupal\eck\Controller\EckEntityTypeListBuilder->buildRow() (line 98 of modules/eck/src/Controller/EckEntityTypeListBuilder.php).
("question" is my ECK type)
It didn't finish deleting fully. If I go back when I first get the error message to the delete confirmation page, it shows fewer things to delete, but it still shows things. Those things must reference the base table, which must have been deleted before the thing that references it.
It DID work fine when I went in and deleted the bundle first, and then deleted the ECK type, which leads me to believe it's simply the order of deletion when deleting both a type and its bundles at the same time which is the issue.
Is this a separate issue I should open?
Comment #14
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commentedHmm, another update to my previous report.
On an entity type that caused this issue last time, I restored my database, deleted the bundle first, then deleted the entity type. It worked fine, but I still end up with this error when I try to do other things:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "document" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 133 of core/lib/Drupal/Core/Entity/EntityTypeManager.php).
I even wrote a Drush script that clears the EntityTypeManager cache in the same way the patch here does and running that manually does not resolve this.
Comment #15
legolasbo@bmcclure,
Could you provide some clear steps to reproduce your findings on a clean installation with this patch applied?
Comment #16
legolasbo@bmcclure I'm curious as to how you removed the entity type without removing the bundle first since that should not be possible since well before alpha 1.
When you try to delete an entity type without deleting it's bundles first you should get this message:
testtype has 1 bundle. Please delete all testtype bundles.
Are you sure you've applied the patch to a recent version (latest dev) of eck?
Comment #17
legolasboSetting this back to needs review as I can't reproduce the problem described in #14 when applying the patch to the latest dev version.
Comment #18
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commentedIt's possible still for me, even with the current release of ECK. Here are my steps:
1. Go to Structure -> ECK Entity Types
2. Create a new entity type (in my case, "distributor")
3. Create a new bundle in that entity type (in my case I again called it "distributor") and add some fields
4. Go back to Structure -> ECK Entity Types
5. Hover over the operation links for the new entity type, and choose Delete.
6. On the following confirmation page, it lists everything that will be deleted, and in my case does not list the bundle.
7. If I confirm, I start getting errors due to the bundle still existing but the entity type being deleted.
I've found that this is also the behavior I get when using Config Synchronization to delete an entity type. Even if I go through the proper steps of deleting the bundle, then deleting the entity type, if I run `drush cex` to export my site config, and then import it onto a version of the site which still has that ECK entity type and bundle created, it seems to delete the entity type first and put the site into a bad state, not allowing any more config importing or anything until I restore the database and delete the bundle manually first.
Comment #19
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commentedAlso regarding your other message, yes I have the latest dev version of the module. I just ran through my steps again to confirm it's still working like that for me, and it is--it does not complain about there being an existing bundle in my case.
Comment #20
jzavrl CreditAttribution: jzavrl at NDP commentedI can confirm the patch works, but only on the 1.x-dev.
Had to download the dev version, recreate my previously deleted entity types and bundles, delete them again and then I could uninstall the module. The error appeared for me when also when I was deleting fields for example from nodes. Now the error is gone.
Comment #21
legolasboSetting to Needs work because of the steps to reproduce provided in #18
Comment #22
MatroskeenComment #23
legolasboI believe this has been fixed by #2925809: site crash on deleting ECK type?.