It's unfortunate that a stable release of this module depends upon a beta release of EntityAPI...

#2926988: Remove RevisionableEntityBundleInterface provided by core removes an interface this module depends upon, because it has been moved to core. The "use" declarations need to get updated from Drupal\entity\Entity\RevisionableEntityBundleInterface to Drupal\core\Entity\RevisionableEntityBundleInterface.

Comments

freelock created an issue. See original summary.

freelock’s picture

Example of the error thrown:

PHP Fatal error:  Interface 'Drupal\entity\Entity\RevisionableEntityBundleInterface' not found in /var/www/html/site/modules/contrib/media_entity/src/MediaBundleInterface.php on line 11
PHP Stack trace:
PHP   1. {main}() /usr/local/composer/vendor/drush/drush/drush.php:0
PHP   2. drush_main() /usr/local/composer/vendor/drush/drush/drush.php:12
PHP   3. Drush\Boot\BaseBoot->bootstrap_and_dispatch() /usr/local/composer/vendor/drush/drush/includes/preflight.inc:66
PHP   4. drush_dispatch() /usr/local/composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php:67
PHP   5. call_user_func_array() /usr/local/composer/vendor/drush/drush/includes/command.inc:199
PHP   6. drush_command() /usr/local/composer/vendor/drush/drush/includes/command.inc:199
PHP   7. _drush_invoke_hooks() /usr/local/composer/vendor/drush/drush/includes/command.inc:231
PHP   8. call_user_func_array() /usr/local/composer/vendor/drush/drush/includes/command.inc:422
PHP   9. drush_cache_rebuild() /usr/local/composer/vendor/drush/drush/includes/command.inc:422
PHP  10. drupal_rebuild() /usr/local/composer/vendor/drush/drush/commands/core/cache.drush.inc:302
PHP  11. drupal_flush_all_caches() /var/www/html/site/core/includes/utility.inc:52
PHP  12. Drupal\Core\Extension\ModuleHandler->invokeAll() /var/www/html/site/core/includes/common.inc:1149
PHP  13. call_user_func_array() /var/www/html/site/core/lib/Drupal/Core/Extension/ModuleHandler.php:402
PHP  14. block_rebuild() /var/www/html/site/core/lib/Drupal/Core/Extension/ModuleHandler.php:402
PHP  15. Drupal\Core\Entity\EntityTypeManager->getStorage() /var/www/html/site/core/modules/block/block.module:143
PHP  16. Drupal\Core\Entity\EntityTypeManager->getHandler() /var/www/html/site/core/lib/Drupal/Core/Entity/EntityTypeManager.php:169
PHP  17. Drupal\Core\Entity\EntityTypeManager->getDefinition() /var/www/html/site/core/lib/Drupal/Core/Entity/EntityTypeManager.php:233
PHP  18. Drupal\Core\Plugin\DefaultPluginManager->getDefinition() /var/www/html/site/core/lib/Drupal/Core/Entity/EntityTypeManager.php:126
PHP  19. Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() /var/www/html/site/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryCachedTrait.php:22
PHP  20. Drupal\Core\Entity\EntityTypeManager->findDefinitions() /var/www/html/site/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php:175
PHP  21. Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery->getDefinitions() /var/www/html/site/core/lib/Drupal/Core/Entity/EntityTypeManager.php:106
PHP  22. Drupal\Core\Entity\Annotation\ConfigEntityType->get() /var/www/html/site/core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php:149
PHP  23. Drupal\Core\Entity\Annotation\EntityType->get() /var/www/html/site/core/lib/Drupal/Core/Entity/Annotation/ConfigEntityType.php:36
PHP  24. Drupal\Core\Config\Entity\ConfigEntityType->__construct() /var/www/html/site/core/lib/Drupal/Core/Entity/Annotation/EntityType.php:60
PHP  25. Drupal\Core\Entity\EntityType->__construct() /var/www/html/site/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php:63
PHP  26. Drupal\Core\Entity\EntityType->entityClassImplements() /var/www/html/site/core/lib/Drupal/Core/Entity/EntityType.php:323
PHP  27. is_subclass_of() /var/www/html/site/core/lib/Drupal/Core/Entity/EntityType.php:439
PHP  28. spl_autoload_call() /var/www/html/site/core/lib/Drupal/Core/Entity/EntityType.php:439
PHP  29. Composer\Autoload\ClassLoader->loadClass() /var/www/html/site/core/lib/Drupal/Core/Entity/EntityType.php:0
PHP  30. Composer\Autoload\includeFile() /usr/local/composer/vendor/composer/ClassLoader.php:322
PHP  31. include() /usr/local/composer/vendor/composer/ClassLoader.php:440
PHP  32. spl_autoload_call() /usr/local/composer/vendor/composer/ClassLoader.php:56
PHP  33. Composer\Autoload\ClassLoader->loadClass() /usr/local/composer/vendor/composer/ClassLoader.php:0
PHP  34. Composer\Autoload\includeFile() /usr/local/composer/vendor/composer/ClassLoader.php:322
PHP  35. include() /usr/local/composer/vendor/composer/ClassLoader.php:440
Drush command terminated abnormally due to an unrecoverable error.                                       [error]
Error: Interface 'Drupal\entity\Entity\RevisionableEntityBundleInterface' not found in
/var/www/html/site/modules/contrib/media_entity/src/MediaBundleInterface.php, line 11
Anonymous’s picture

There is another problem with the extends RevisionableContentEntityForm. If you change the namespace interface you will receive the next error.

freelock’s picture

Status: Active » Needs review
StatusFileSize
new998 bytes

Patch attached, also fixes fatal error from the removed RevisionableContentEntityForm.

Status: Needs review » Needs work

The last submitted patch, 4: media_entity-entity-namespace-change.patch, failed testing. View results

freelock’s picture

Patch fails because of this:

1) Drupal\Tests\media_entity\Functional\MediaUiFunctionalTest::testMediaWithOnlyOneBundle
Behat\Mink\Exception\ElementNotFoundException: Form field with id|name|label|value "edit-revision" not found.

... is there a comparable field in the ContentEntityForm, or what are we missing here?

bojanz’s picture

Look at ContentEntityForm::addRevisionableFormFields() and then compare the fields.
I see a "revision" checkbox there, so I'm unsure why the test would not be finding it.

johnpitcairn’s picture

For anyone in this situation, it appears that pegging composer to drupal/entity 1.0-beta1 will survive the 8.4.5 to 8.5.0 update and still work, until this fix is in.

lvbeck’s picture

same problem on drupal 8.5.0, have to rollback to entity-8.x-1.0-beta1

idiaz.roncero’s picture

Same here, completely unable to update Drupal to 8.5 using Composer due to this error.

(media entity is at 1.x)

Using entity-8.x-1.0-beta1 works.

chr.fritsch’s picture

bojanz’s picture

I'll tag a beta3 of Entity API today that resolves this.

alexpott’s picture

The media entity needs to have the show_revision_ui annotation set. And also the test needs adjusting because it is making assumptions about the url redirects and form elements that are no longer true. For example when creating a completing new entity the revision stuff is not there with the core form because it makes no sense. It is there with the entity module version afaics.

The new patch in #2952495: [beta2 regression] Undo class removal, deprecate them instead fixes the media entity module and gives it some time to move to core's new API.

bojanz’s picture

I've tagged beta3 which fixes this issue.

However, the Entity API class has known issues not present in the core version, so moving to ContentEntityForm should be a priority.

alexpott’s picture

Category: Bug report » Task
Status: Needs work » Needs review
StatusFileSize
new4.62 KB

Here's what's necessary to make the tests go green using core APIs. I think we're going to need an upgrade path here to add the revision_log to the entity form displays.

This is now a task since the entity module has reverted their API breaking changes.

alexpott’s picture

Title: Media Entity breaks site with upgrade to entity-8.x-1.0-beta2 » Update Media Entity to use 8.5.x APIs
alexpott’s picture

StatusFileSize
new1.99 KB
new5.75 KB

I've tested and actually we don't need an upgrade path. Also we can use more of the core API.

yang_yi_cn’s picture

Status: Needs review » Needs work

I tried the patch in #17 but had some PHP errors after saving / re-edit a media entity. Note that I have "create new revision" set as default but there's no revision UI showing.