In anticipation of the core issue getting approved (#2455949: [policy, no patch] Re-activate the head2head project and use it for beta2beta upgrades in the short-term), I upgraded this module to D8, wrote an initial beta2beta submodule and provided the first upgrade function for #1847596: Remove Taxonomy term reference field in favor of Entity reference.

We still need to port the UI and the ability to run specific upgrade functions regardless of the installed module schema, but at least it's a start and the current code + taxonomy field update works :)

CommentFileSizeAuthor
#7 interdiff.txt7.58 KBamateescu
#1 2456419.patch11.63 KBamateescu
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amateescu’s picture

Status: Active » Needs review
FileSize
11.63 KB

And the patch. We should probably open a 8.x-1.x branch for this.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Looks great for start!

Wim Leers’s picture

@amateescu++

rpayanm’s picture

I test this patch on a site on beta 7:

Step:
1. Enable the module beta2beta.
2. When I visit a article page with taxonomy term I got this error:

Exception: The Taxonomy term reference field has been removed. You should run the database update script immediately. in Drupal\beta2beta\PluginOverride\Field\FieldType\TaxonomyTermReferenceItem->__construct() (line 22 of sites/d8/modules/contrib/head2head/beta2beta/src/PluginOverride/Field/FieldType/TaxonomyTermReferenceItem.php).

Drupal\Core\TypedData\TypedData::createInstance(Object, 0, Object)
Drupal\Core\TypedData\TypedDataManager->createInstance('field_item:taxonomy_term_reference', Array)
Drupal\Core\TypedData\TypedDataManager->create(Object, NULL, 0, Object)
Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object, 0, Array)
Drupal\Core\Field\FieldTypePluginManager->createFieldItem(Object, 0, Array)
Drupal\Core\Field\FieldItemList->createItem(0, Array)
Drupal\Core\TypedData\Plugin\DataType\ItemList->setValue(Array, )
Drupal\Core\Field\FieldItemList->setValue(Array, )
Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object, 'field_tags', Array)
Drupal\Core\Field\FieldTypePluginManager->createFieldItemList(Object, 'field_tags', Array)
Drupal\Core\Entity\ContentEntityBase->getTranslatedField('field_tags', 'x-default')
Drupal\Core\Entity\ContentEntityBase->get('field_tags')
Drupal\Core\Entity\EntityViewBuilder->buildComponents(Array, Array, Array, 'full', 'en')
Drupal\node\NodeViewBuilder->buildComponents(Array, Array, Array, 'full', 'en')
Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array)
Drupal\Core\Entity\EntityViewBuilder->build(Array)
call_user_func(Array, Array)
Drupal\Core\Render\Renderer->doRender(Array)
Drupal\Core\Render\Renderer->doRender(Array, )
Drupal\Core\Render\Renderer->render(Array, )
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\PageCache->pass(Object, 1, 1)
Drupal\Core\StackMiddleware\PageCache->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1)
Stack\StackedHttpKernel->handle(Object, 1, 1)
Drupal\Core\DrupalKernel->handle(Object)

3. Then I went to mysite/update.php and run the updates: I got other error:

module system
Actualización #0 - Update entity definitions

Error: Drupal\Core\Entity\EntityStorageException: The SQL storage cannot change the schema for an existing entity type with data. en Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onEntityTypeUpdate() (line 265 de /var/www/d8/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).

And the error on article page is the same.

amateescu’s picture

@rpayanm, the first one is by design (so not actually an error) because we want to restrict people from doing any kind of change to a taxonomy reference field before running the update script :)

The second one is not related to the first upgrade function provided by this patch so we'll need to investigate that in another issue. Note that #2340993: SqlContentEntityStorageSchema::requiresEntityDataMigration() returns TRUE for cases where it should return FALSE has been committed today so it's possible that your second error is already fixed.

  • amateescu committed 1093c86 on 8.x-1.x
    Issue #2456419 by amateescu: Initial port to D8 and a beta2beta...
amateescu’s picture

Status: Reviewed & tested by the community » Fixed
FileSize
7.58 KB

I finished porting the UI from alpha2alpha, moved the first update function to the "beta10" namespace and added support for all taxonomy reference formatters.

amateescu’s picture

Issue tags: +D8 Accelerate

Retroactive tagging.

Status: Fixed » Closed (fixed)

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